Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(914)

Unified Diff: chrome/browser/views/status_icons/status_icon_win.h

Issue 3189003: Added support for context menus to status icons. (Closed)
Patch Set: Final version. Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/views/status_icons/status_icon_win.h
diff --git a/chrome/browser/views/status_icons/status_icon_win.h b/chrome/browser/views/status_icons/status_icon_win.h
index e3f88f4295c6d3a8ad4b6a7abf68c45e5021ab40..f698fc4f309d3dadb1ecd978fa388deb396318a2 100644
--- a/chrome/browser/views/status_icons/status_icon_win.h
+++ b/chrome/browser/views/status_icons/status_icon_win.h
@@ -10,8 +10,13 @@
#include <shellapi.h>
#include "base/scoped_handle_win.h"
+#include "base/scoped_ptr.h"
#include "chrome/browser/status_icons/status_icon.h"
+namespace views {
+class Menu2;
+}
+
class StatusIconWin : public StatusIcon {
public:
// Constructor which provides this icon's unique ID and messaging window.
@@ -27,6 +32,14 @@ class StatusIconWin : public StatusIcon {
UINT message_id() const { return message_id_; }
+ // Handles a click event from the user - if |left_button_click| is true and
+ // there is a registered observer, passes the click event to the observer,
+ // otherwise displays the context menu if there is one.
+ void HandleClickEvent(int x, int y, bool left_button_click);
+
+ protected:
+ virtual void ResetContextMenu(menus::MenuModel* menu);
+
private:
void InitIconData(NOTIFYICONDATA* icon_data);
@@ -42,6 +55,9 @@ class StatusIconWin : public StatusIcon {
// The currently-displayed icon for the window.
ScopedHICON icon_;
+ // Context menu associated with this icon (if any).
+ scoped_ptr<views::Menu2> context_menu_;
+
DISALLOW_COPY_AND_ASSIGN(StatusIconWin);
};
« no previous file with comments | « chrome/browser/status_icons/status_tray_unittest.cc ('k') | chrome/browser/views/status_icons/status_icon_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698