diff options
author | petewil@chromium.org <petewil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-11 19:58:05 +0000 |
---|---|---|
committer | petewil@chromium.org <petewil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-11 19:58:05 +0000 |
commit | 3a585276f38d07d23f84d7664791c58d58c60b29 (patch) | |
tree | 5d52a67ca0bb582af6143abffaa60ac7a8ea2ab9 /chrome/browser/notifications/sync_notifier/chrome_notifier_delegate.h | |
parent | 0e01c0207a24c425287dee4bf77dbf7478140a41 (diff) | |
download | chromium_src-3a585276f38d07d23f84d7664791c58d58c60b29.zip chromium_src-3a585276f38d07d23f84d7664791c58d58c60b29.tar.gz chromium_src-3a585276f38d07d23f84d7664791c58d58c60b29.tar.bz2 |
Add implementation and tests for clicking on a notification.
To round out the feature of clicking on the body of a notification or on a
text button, we should navigate to the appropriate URL for the background
or button. This change adds code to do that, and the proper browser tests.
This change also refactors the button code to be able to accept an arbitrary
number of buttons from the synced notification. Note that Rich Notifications
is still limited to two buttons, though, so only two buttons are passed to Rich
Notifications.
This change also includes a refactoring to return GURL everywhere we have a
URL instead of returning a string.
BUG=247564
Review URL: https://chromiumcodereview.appspot.com/17450021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211193 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/notifications/sync_notifier/chrome_notifier_delegate.h')
-rw-r--r-- | chrome/browser/notifications/sync_notifier/chrome_notifier_delegate.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/chrome/browser/notifications/sync_notifier/chrome_notifier_delegate.h b/chrome/browser/notifications/sync_notifier/chrome_notifier_delegate.h index ad462b8..79e1554 100644 --- a/chrome/browser/notifications/sync_notifier/chrome_notifier_delegate.h +++ b/chrome/browser/notifications/sync_notifier/chrome_notifier_delegate.h @@ -8,6 +8,7 @@ #include <string> #include "chrome/browser/notifications/notification_delegate.h" +#include "googleurl/src/gurl.h" namespace notifier { @@ -19,21 +20,26 @@ class ChromeNotifierService; class ChromeNotifierDelegate : public NotificationDelegate { public: - explicit ChromeNotifierDelegate(const std::string& id, + // We use an id instead of a notification so we can check to see if the + // notification still exists before acting on it instead of using a ref count. + explicit ChromeNotifierDelegate(const std::string& notification_id, ChromeNotifierService* notifier); // NotificationDelegate interface. virtual void Display() OVERRIDE {} virtual void Error() OVERRIDE {} virtual void Close(bool by_user) OVERRIDE; - virtual void Click() OVERRIDE {} + virtual void Click() OVERRIDE; + virtual void ButtonClick(int button_index) OVERRIDE; virtual std::string id() const OVERRIDE; + virtual content::RenderViewHost* GetRenderViewHost() const OVERRIDE; private: virtual ~ChromeNotifierDelegate(); + void NavigateToUrl(const GURL& destination) const; - const std::string id_; + const std::string notification_id_; ChromeNotifierService* const chrome_notifier_; DISALLOW_COPY_AND_ASSIGN(ChromeNotifierDelegate); |