summaryrefslogtreecommitdiffstats
path: root/ui/message_center/message_center.h
diff options
context:
space:
mode:
authormiket@chromium.org <miket@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-14 01:53:10 +0000
committermiket@chromium.org <miket@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-14 01:53:10 +0000
commit7af7a3ec9ffc803d7fb19048920a7102f209bfe8 (patch)
treef482753affa3dc437a2e05cc7d5a08da311ef3c5 /ui/message_center/message_center.h
parent61bf48eafc0f98f57036f777c253f178b8744ef0 (diff)
downloadchromium_src-7af7a3ec9ffc803d7fb19048920a7102f209bfe8.zip
chromium_src-7af7a3ec9ffc803d7fb19048920a7102f209bfe8.tar.gz
chromium_src-7af7a3ec9ffc803d7fb19048920a7102f209bfe8.tar.bz2
Plumb the ButtonPressed callback of the two buttons in BaseFormatView through to the NotificationDelegate's new ButtonClick() method.
The practical point of this CL is twofold: (1) provide a good stopping point for the larger goal of sending this new ButtonClick event to JavaScript callers, and (2) provide new useful functionality to C++ code that is interested in button-click events. 0. Remove vestigal intents fields, which we're replacing with explicit callbacks. 1. Make BaseFormatView's ButtonPressed() send a new NotificationList::Delegate::OnButtonClicked(). 2. MessageCenter passes that through to MessageCenter::Delegate::OnButtonClicked(), which has the same name as the above delegate method but is NOT directly related. 3. BalloonCollectionImplAsh looks up the specific balloon whose button was clicked, then calls the appropriate OnButtonClick() (note the change in tense). 4. chrome/browser/notifications/balloon passes the baton to the Notification that it owns, calling its ButtonClick() method. 5. The Notification's delegate handles ButtonClick(). Again, these two method share the name but are not strictly related. 6. In the case we'll eventually care about, notification_api.cc will implement a functional ButtonClick(). But for now this implementation is a stub. BUG=164249 Review URL: https://chromiumcodereview.appspot.com/11546003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173043 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/message_center/message_center.h')
-rw-r--r--ui/message_center/message_center.h21
1 files changed, 16 insertions, 5 deletions
diff --git a/ui/message_center/message_center.h b/ui/message_center/message_center.h
index 73f6269..5f5bb4f 100644
--- a/ui/message_center/message_center.h
+++ b/ui/message_center/message_center.h
@@ -41,21 +41,30 @@ class MESSAGE_CENTER_EXPORT MessageCenter : public NotificationList::Delegate {
public:
// Called when the notification associated with |notification_id| is
// removed (i.e. closed by the user).
- virtual void NotificationRemoved(const std::string& notifcation_id) = 0;
+ virtual void NotificationRemoved(const std::string& notification_id) = 0;
// Request to disable the extension associated with |notification_id|.
- virtual void DisableExtension(const std::string& notifcation_id) = 0;
+ virtual void DisableExtension(const std::string& notification_id) = 0;
// Request to disable notifications from the source of |notification_id|.
virtual void DisableNotificationsFromSource(
- const std::string& notifcation_id) = 0;
+ const std::string& notification_id) = 0;
// Request to show the notification settings (|notification_id| is used
// to identify the requesting browser context).
- virtual void ShowSettings(const std::string& notifcation_id) = 0;
+ virtual void ShowSettings(const std::string& notification_id) = 0;
// Called when the notification body is clicked on.
- virtual void OnClicked(const std::string& notifcation_id) = 0;
+ virtual void OnClicked(const std::string& notification_id) = 0;
+
+ // Called when a button in a notification is clicked. |button_index|
+ // indicates which button was clicked, zero-indexed (button one is 0,
+ // button two is 1).
+ //
+ // TODO(miket): consider providing default implementations for the pure
+ // virtuals above, to avoid changing so many files in disparate parts of
+ // the codebase each time we enhance this interface.
+ virtual void OnButtonClicked(const std::string& id, int button_index);
protected:
virtual ~Delegate() {}
@@ -117,6 +126,8 @@ class MESSAGE_CENTER_EXPORT MessageCenter : public NotificationList::Delegate {
virtual void ShowNotificationSettings(const std::string& id) OVERRIDE;
virtual void OnNotificationClicked(const std::string& id) OVERRIDE;
virtual void OnQuietModeChanged(bool quiet_mode) OVERRIDE;
+ virtual void OnButtonClicked(const std::string& id, int button_index)
+ OVERRIDE;
virtual NotificationList* GetNotificationList() OVERRIDE;
private: