diff --git a/atom/browser/api/atom_api_notification.cc b/atom/browser/api/atom_api_notification.cc index 351ff15d9990..cfe31bc7c3dd 100644 --- a/atom/browser/api/atom_api_notification.cc +++ b/atom/browser/api/atom_api_notification.cc @@ -126,7 +126,7 @@ void Notification::SetHasReply(bool new_has_reply) { } void Notification::SetActions( - const std::vector actions) { + const std::vector& actions) { actions_ = actions; } diff --git a/atom/browser/api/atom_api_notification.h b/atom/browser/api/atom_api_notification.h index 9b933fc44d26..3745f4309b1a 100644 --- a/atom/browser/api/atom_api_notification.h +++ b/atom/browser/api/atom_api_notification.h @@ -60,7 +60,7 @@ class Notification : public mate::TrackableObject, void SetSilent(bool new_silent); void SetReplyPlaceholder(const base::string16& new_reply_placeholder); void SetHasReply(bool new_has_reply); - void SetActions(const std::vector actions); + void SetActions(const std::vector& actions); private: base::string16 title_; diff --git a/brightray/browser/mac/cocoa_notification.h b/brightray/browser/mac/cocoa_notification.h index 5fa1a98e19d7..dcc430099fe5 100644 --- a/brightray/browser/mac/cocoa_notification.h +++ b/brightray/browser/mac/cocoa_notification.h @@ -33,7 +33,7 @@ class CocoaNotification : public Notification { private: base::scoped_nsobject notification_; - int actionIndex_; + int action_index_; DISALLOW_COPY_AND_ASSIGN(CocoaNotification); }; diff --git a/brightray/browser/mac/cocoa_notification.mm b/brightray/browser/mac/cocoa_notification.mm index 56aaf81e3507..66a80f6f6672 100644 --- a/brightray/browser/mac/cocoa_notification.mm +++ b/brightray/browser/mac/cocoa_notification.mm @@ -44,14 +44,14 @@ void CocoaNotification::Show(const NotificationOptions& options) { [notification_ setHasActionButton:false]; - for (size_t i = 0; i < options.actions.size(); i++) { - NotificationAction action = options.actions[i]; - - if (action.type == base::UTF8ToUTF16("button")) { + int i = 0; + for (const auto& action : options.actions) { + if (action.type == base::ASCIIToUTF16("button")) { [notification_ setHasActionButton:true]; [notification_ setActionButtonTitle:base::SysUTF16ToNSString(action.text)]; - actionIndex_ = i; + action_index_ = i; } + i++; } if (options.has_reply) { @@ -82,7 +82,7 @@ void CocoaNotification::NotificationReplied(const std::string& reply) { void CocoaNotification::NotificationButtonClicked() { if (delegate()) - delegate()->NotificationAction(actionIndex_); + delegate()->NotificationAction(action_index_); } } // namespace brightray