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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_VIEWS_STATUS_ICONS_STATUS_ICON_WIN_H_ 5 #ifndef CHROME_BROWSER_VIEWS_STATUS_ICONS_STATUS_ICON_WIN_H_
6 #define CHROME_BROWSER_VIEWS_STATUS_ICONS_STATUS_ICON_WIN_H_ 6 #define CHROME_BROWSER_VIEWS_STATUS_ICONS_STATUS_ICON_WIN_H_
7 #pragma once 7 #pragma once
8 8
9 #include <windows.h> 9 #include <windows.h>
10 #include <shellapi.h> 10 #include <shellapi.h>
11 11
12 #include "base/scoped_handle_win.h" 12 #include "base/scoped_handle_win.h"
13 #include "base/scoped_ptr.h"
13 #include "chrome/browser/status_icons/status_icon.h" 14 #include "chrome/browser/status_icons/status_icon.h"
14 15
16 namespace views {
17 class Menu2;
18 }
19
15 class StatusIconWin : public StatusIcon { 20 class StatusIconWin : public StatusIcon {
16 public: 21 public:
17 // Constructor which provides this icon's unique ID and messaging window. 22 // Constructor which provides this icon's unique ID and messaging window.
18 StatusIconWin(UINT id, HWND window, UINT message); 23 StatusIconWin(UINT id, HWND window, UINT message);
19 virtual ~StatusIconWin(); 24 virtual ~StatusIconWin();
20 25
21 // Overridden from StatusIcon: 26 // Overridden from StatusIcon:
22 virtual void SetImage(const SkBitmap& image); 27 virtual void SetImage(const SkBitmap& image);
23 virtual void SetPressedImage(const SkBitmap& image); 28 virtual void SetPressedImage(const SkBitmap& image);
24 virtual void SetToolTip(const string16& tool_tip); 29 virtual void SetToolTip(const string16& tool_tip);
25 30
26 UINT icon_id() const { return icon_id_; } 31 UINT icon_id() const { return icon_id_; }
27 32
28 UINT message_id() const { return message_id_; } 33 UINT message_id() const { return message_id_; }
29 34
35 // Handles a click event from the user - if |left_button_click| is true and
36 // there is a registered observer, passes the click event to the observer,
37 // otherwise displays the context menu if there is one.
38 void HandleClickEvent(int x, int y, bool left_button_click);
39
40 protected:
41 virtual void ResetContextMenu(menus::MenuModel* menu);
42
30 private: 43 private:
31 void InitIconData(NOTIFYICONDATA* icon_data); 44 void InitIconData(NOTIFYICONDATA* icon_data);
32 45
33 // The unique ID corresponding to this icon. 46 // The unique ID corresponding to this icon.
34 UINT icon_id_; 47 UINT icon_id_;
35 48
36 // Window used for processing messages from this icon. 49 // Window used for processing messages from this icon.
37 HWND window_; 50 HWND window_;
38 51
39 // The message identifier used for status icon messages. 52 // The message identifier used for status icon messages.
40 UINT message_id_; 53 UINT message_id_;
41 54
42 // The currently-displayed icon for the window. 55 // The currently-displayed icon for the window.
43 ScopedHICON icon_; 56 ScopedHICON icon_;
44 57
58 // Context menu associated with this icon (if any).
59 scoped_ptr<views::Menu2> context_menu_;
60
45 DISALLOW_COPY_AND_ASSIGN(StatusIconWin); 61 DISALLOW_COPY_AND_ASSIGN(StatusIconWin);
46 }; 62 };
47 63
48 #endif // CHROME_BROWSER_VIEWS_STATUS_ICONS_STATUS_ICON_WIN_H_ 64 #endif // CHROME_BROWSER_VIEWS_STATUS_ICONS_STATUS_ICON_WIN_H_
OLDNEW
« 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