From db081d95d53e7f9629e6664a310f39f3b193541b Mon Sep 17 00:00:00 2001 From: Charlie Hess Date: Mon, 21 Aug 2017 13:53:50 -0700 Subject: [PATCH] Review CommentZ. --- atom/browser/api/atom_api_notification.cc | 8 ++++---- atom/browser/api/atom_api_notification.h | 4 ++-- docs/api/notification.md | 15 +++++++++++++++ 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/atom/browser/api/atom_api_notification.cc b/atom/browser/api/atom_api_notification.cc index 325a101a3655..ef5b9ce1296a 100644 --- a/atom/browser/api/atom_api_notification.cc +++ b/atom/browser/api/atom_api_notification.cc @@ -114,7 +114,7 @@ std::vector Notification::GetActions() const { return actions_; } -base::string16 Notification::GetSoundName() const { +base::string16 Notification::GetSound() const { return sound_; } @@ -148,7 +148,7 @@ void Notification::SetActions( actions_ = actions; } -void Notification::SetSoundName(const base::string16& new_sound) { +void Notification::SetSound(const base::string16& new_sound) { sound_ = new_sound; } @@ -218,8 +218,8 @@ void Notification::BuildPrototype(v8::Isolate* isolate, &Notification::SetHasReply) .SetProperty("actions", &Notification::GetActions, &Notification::SetActions) - .SetProperty("soundName", &Notification::GetSoundName, - &Notification::SetSoundName); + .SetProperty("sound", &Notification::GetSound, + &Notification::SetSound); } } // namespace api diff --git a/atom/browser/api/atom_api_notification.h b/atom/browser/api/atom_api_notification.h index 2050e513eb4e..d4679e7c2c90 100644 --- a/atom/browser/api/atom_api_notification.h +++ b/atom/browser/api/atom_api_notification.h @@ -54,7 +54,7 @@ class Notification : public mate::TrackableObject, base::string16 GetReplyPlaceholder() const; bool GetHasReply() const; std::vector GetActions() const; - base::string16 GetSoundName() const; + base::string16 GetSound() const; // Prop Setters void SetTitle(const base::string16& new_title); @@ -64,7 +64,7 @@ class Notification : public mate::TrackableObject, void SetReplyPlaceholder(const base::string16& new_reply_placeholder); void SetHasReply(bool new_has_reply); void SetActions(const std::vector& actions); - void SetSoundName(const base::string16& sound); + void SetSound(const base::string16& sound); private: base::string16 title_; diff --git a/docs/api/notification.md b/docs/api/notification.md index eb55b97245fd..f75829119eb8 100644 --- a/docs/api/notification.md +++ b/docs/api/notification.md @@ -103,3 +103,18 @@ Immediately shows the notification to the user, please note this means unlike th HTML5 Notification implementation, simply instantiating a `new Notification` does not immediately show it to the user, you need to call this method before the OS will display it. + +### Playing Sounds _macOS_ + +On macOS, you can specify the name of the sound you'd like to play when the +notification is shown. Any of the default sounds (under System Preferences > +Sound) can be used, in addition to custom sound files. Be sure that the sound +file is included with the app bundle (e.g., `YourApp.app/Contents/Resources`), +or copied into one of the following locations: + +* `~/Library/Sounds` +* `/Library/Sounds` +* `/Network/Library/Sounds` +* `/System/Library/Sounds` + +See the [`NSSound`](https://developer.apple.com/documentation/appkit/nssound) docs for more information.