diff options
author | johnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-10 06:27:38 +0000 |
---|---|---|
committer | johnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-10 06:27:38 +0000 |
commit | 9429e976325c93329fd5d35e18699b8c47411f84 (patch) | |
tree | 4cd2048ae521a351b92d8b50863c52eb97489947 /chrome/browser/views/notifications/balloon_view.h | |
parent | 0c98d920fa52263e940683fea1c8bb2d870f42bb (diff) | |
download | chromium_src-9429e976325c93329fd5d35e18699b8c47411f84.zip chromium_src-9429e976325c93329fd5d35e18699b8c47411f84.tar.gz chromium_src-9429e976325c93329fd5d35e18699b8c47411f84.tar.bz2 |
Adds an options menu to the frame of the desktop notification, for now with the single option of revoking permissions from that origin.
The renderer side change is a related issue that the full URL was being sent as the "source" of the notification rather than only the origin.
BUG=26690
TEST=open a notification
Review URL: http://codereview.chromium.org/363011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31547 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/notifications/balloon_view.h')
-rw-r--r-- | chrome/browser/views/notifications/balloon_view.h | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/chrome/browser/views/notifications/balloon_view.h b/chrome/browser/views/notifications/balloon_view.h index 0d7dd0a..3f5c751 100644 --- a/chrome/browser/views/notifications/balloon_view.h +++ b/chrome/browser/views/notifications/balloon_view.h @@ -18,6 +18,9 @@ #include "chrome/browser/notifications/balloon.h" #include "chrome/common/notification_registrar.h" #include "chrome/common/notification_service.h" +#include "views/controls/button/menu_button.h" +#include "views/controls/menu/simple_menu_model.h" +#include "views/controls/menu/view_menu_delegate.h" #include "views/view.h" namespace views { @@ -36,6 +39,8 @@ class SlideAnimation; // It draws a border, and within the border an HTML renderer. class BalloonViewImpl : public BalloonView, public views::View, + public views::ViewMenuDelegate, + public views::SimpleMenuModel::Delegate, public NotificationObserver, public AnimationDelegate { public: @@ -48,7 +53,7 @@ class BalloonViewImpl : public BalloonView, void Close(bool by_user); private: - // Overridden from views::View. + // views::View interface. virtual void Paint(gfx::Canvas* canvas); virtual void DidChangeBounds(const gfx::Rect& previous, const gfx::Rect& current); @@ -56,14 +61,30 @@ class BalloonViewImpl : public BalloonView, return gfx::Size(1000, 1000); } - // NotificationObserver method. + // views::ViewMenuDelegate interface. + void RunMenu(views::View* source, const gfx::Point& pt); + + // views::SimpleMenuModel::Delegate interface. + virtual bool IsCommandIdChecked(int command_id) const; + virtual bool IsCommandIdEnabled(int command_id) const; + virtual bool GetAcceleratorForCommandId(int command_id, + views::Accelerator* accelerator); + virtual void ExecuteCommand(int command_id); + + // NotificationObserver interface. virtual void Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details); - // AnimationDelegate method. + // AnimationDelegate interface. virtual void AnimationProgressed(const Animation* animation); + // Launches the options menu at screen coordinates |pt|. + void RunOptionsMenu(const gfx::Point& pt); + + // Initializes the options menu. + void CreateOptionsMenu(); + // How to mask the balloon contents to fit within the frame. // Populates |path| with the outline. void GetContentsMask(const gfx::Rect& contents_rect, gfx::Path* path) const; @@ -126,6 +147,11 @@ class BalloonViewImpl : public BalloonView, gfx::Rect anim_frame_start_; gfx::Rect anim_frame_end_; + // The options menu. + scoped_ptr<views::SimpleMenuModel> options_menu_contents_; + scoped_ptr<views::Menu2> options_menu_menu_; + views::MenuButton* options_menu_button_; + NotificationRegistrar notification_registrar_; DISALLOW_COPY_AND_ASSIGN(BalloonViewImpl); |