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

Side by Side Diff: chrome/browser/ui/views/status_icons/status_icon_win.h

Issue 256443004: Revert of Moves the notification icon out of the status area overflow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_UI_VIEWS_STATUS_ICONS_STATUS_ICON_WIN_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_ICON_WIN_H_
6 #define CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_ICON_WIN_H_ 6 #define CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_ICON_WIN_H_
7 7
8 #include <windows.h> 8 #include <windows.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/win/scoped_gdi_object.h" 14 #include "base/win/scoped_gdi_object.h"
15 #include "chrome/browser/status_icons/status_icon.h" 15 #include "chrome/browser/status_icons/status_icon.h"
16 16
17 namespace gfx { 17 namespace gfx {
18 class Point; 18 class Point;
19 } 19 }
20 20
21 namespace views { 21 namespace views {
22 class MenuRunner; 22 class MenuRunner;
23 } 23 }
24 24
25 class StatusTrayWin;
26
27 class StatusIconWin : public StatusIcon { 25 class StatusIconWin : public StatusIcon {
28 public: 26 public:
29 // Constructor which provides this icon's unique ID and messaging window. 27 // Constructor which provides this icon's unique ID and messaging window.
30 StatusIconWin(StatusTrayWin* tray, UINT id, HWND window, UINT message); 28 StatusIconWin(UINT id, HWND window, UINT message);
31 virtual ~StatusIconWin(); 29 virtual ~StatusIconWin();
32 30
33 // Handles a click event from the user - if |left_button_click| is true and 31 // Handles a click event from the user - if |left_button_click| is true and
34 // there is a registered observer, passes the click event to the observer, 32 // there is a registered observer, passes the click event to the observer,
35 // otherwise displays the context menu if there is one. 33 // otherwise displays the context menu if there is one.
36 void HandleClickEvent(const gfx::Point& cursor_pos, bool left_button_click); 34 void HandleClickEvent(const gfx::Point& cursor_pos, bool left_button_click);
37 35
38 // Handles a click on the balloon from the user. 36 // Handles a click on the balloon from the user.
39 void HandleBalloonClickEvent(); 37 void HandleBalloonClickEvent();
40 38
41 // Re-creates the status tray icon now after the taskbar has been created. 39 // Re-creates the status tray icon now after the taskbar has been created.
42 void ResetIcon(); 40 void ResetIcon();
43 41
44 UINT icon_id() const { return icon_id_; } 42 UINT icon_id() const { return icon_id_; }
45 HWND window() const { return window_; }
46 UINT message_id() const { return message_id_; } 43 UINT message_id() const { return message_id_; }
47 44
48 // Overridden from StatusIcon: 45 // Overridden from StatusIcon:
49 virtual void SetImage(const gfx::ImageSkia& image) OVERRIDE; 46 virtual void SetImage(const gfx::ImageSkia& image) OVERRIDE;
50 virtual void SetPressedImage(const gfx::ImageSkia& image) OVERRIDE; 47 virtual void SetPressedImage(const gfx::ImageSkia& image) OVERRIDE;
51 virtual void SetToolTip(const base::string16& tool_tip) OVERRIDE; 48 virtual void SetToolTip(const base::string16& tool_tip) OVERRIDE;
52 virtual void DisplayBalloon(const gfx::ImageSkia& icon, 49 virtual void DisplayBalloon(const gfx::ImageSkia& icon,
53 const base::string16& title, 50 const base::string16& title,
54 const base::string16& contents) OVERRIDE; 51 const base::string16& contents) OVERRIDE;
55 virtual void ForceVisible() OVERRIDE;
56 52
57 protected: 53 protected:
58 // Overridden from StatusIcon: 54 // Overridden from StatusIcon:
59 virtual void UpdatePlatformContextMenu(StatusIconMenuModel* menu) OVERRIDE; 55 virtual void UpdatePlatformContextMenu(
56 StatusIconMenuModel* menu) OVERRIDE;
60 57
61 private: 58 private:
62 void InitIconData(NOTIFYICONDATA* icon_data); 59 void InitIconData(NOTIFYICONDATA* icon_data);
63 60
64 // The tray that owns us. Weak.
65 StatusTrayWin* tray_;
66
67 // The unique ID corresponding to this icon. 61 // The unique ID corresponding to this icon.
68 UINT icon_id_; 62 UINT icon_id_;
69 63
70 // Window used for processing messages from this icon. 64 // Window used for processing messages from this icon.
71 HWND window_; 65 HWND window_;
72 66
73 // The message identifier used for status icon messages. 67 // The message identifier used for status icon messages.
74 UINT message_id_; 68 UINT message_id_;
75 69
76 // The currently-displayed icon for the window. 70 // The currently-displayed icon for the window.
77 base::win::ScopedHICON icon_; 71 base::win::ScopedHICON icon_;
78 72
79 // The currently-displayed icon for the notification balloon. 73 // The currently-displayed icon for the notification balloon.
80 base::win::ScopedHICON balloon_icon_; 74 base::win::ScopedHICON balloon_icon_;
81 75
82 // Not owned. 76 // Not owned.
83 ui::MenuModel* menu_model_; 77 ui::MenuModel* menu_model_;
84 78
85 // Context menu associated with this icon (if any). 79 // Context menu associated with this icon (if any).
86 scoped_ptr<views::MenuRunner> menu_runner_; 80 scoped_ptr<views::MenuRunner> menu_runner_;
87 81
88 DISALLOW_COPY_AND_ASSIGN(StatusIconWin); 82 DISALLOW_COPY_AND_ASSIGN(StatusIconWin);
89 }; 83 };
90 84
91 #endif // CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_ICON_WIN_H_ 85 #endif // CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_ICON_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698