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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_ICON_WIN_H_
6 #define CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_ICON_WIN_H_
11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/win/scoped_gdi_object.h"
15 #include "chrome/browser/status_icons/status_icon.h"
25 class StatusIconWin
: public StatusIcon
{
27 // Constructor which provides this icon's unique ID and messaging window.
28 StatusIconWin(UINT id
, HWND window
, UINT message
);
29 virtual ~StatusIconWin();
31 // Handles a click event from the user - if |left_button_click| is true and
32 // there is a registered observer, passes the click event to the observer,
33 // otherwise displays the context menu if there is one.
34 void HandleClickEvent(const gfx::Point
& cursor_pos
, bool left_button_click
);
36 // Handles a click on the balloon from the user.
37 void HandleBalloonClickEvent();
39 // Re-creates the status tray icon now after the taskbar has been created.
42 UINT
icon_id() const { return icon_id_
; }
43 UINT
message_id() const { return message_id_
; }
45 // Overridden from StatusIcon:
46 virtual void SetImage(const gfx::ImageSkia
& image
) OVERRIDE
;
47 virtual void SetPressedImage(const gfx::ImageSkia
& image
) OVERRIDE
;
48 virtual void SetToolTip(const string16
& tool_tip
) OVERRIDE
;
49 virtual void DisplayBalloon(const gfx::ImageSkia
& icon
,
50 const string16
& title
,
51 const string16
& contents
) OVERRIDE
;
54 // Overridden from StatusIcon:
55 virtual void UpdatePlatformContextMenu(
56 StatusIconMenuModel
* menu
) OVERRIDE
;
59 void InitIconData(NOTIFYICONDATA
* icon_data
);
61 // The unique ID corresponding to this icon.
64 // Window used for processing messages from this icon.
67 // The message identifier used for status icon messages.
70 // The currently-displayed icon for the window.
71 base::win::ScopedHICON icon_
;
73 // The currently-displayed icon for the notification balloon.
74 base::win::ScopedHICON balloon_icon_
;
77 ui::MenuModel
* menu_model_
;
79 // Context menu associated with this icon (if any).
80 scoped_ptr
<views::MenuRunner
> menu_runner_
;
82 DISALLOW_COPY_AND_ASSIGN(StatusIconWin
);
85 // Implements status notifications using Windows 8 metro style notifications.
86 class StatusIconMetro
: public StatusIcon
{
88 // Constructor which provides this icon's unique ID and messaging window.
89 explicit StatusIconMetro(UINT id
);
90 virtual ~StatusIconMetro();
92 // Overridden from StatusIcon:
93 virtual void SetImage(const gfx::ImageSkia
& image
) OVERRIDE
;
94 virtual void SetPressedImage(const gfx::ImageSkia
& image
) OVERRIDE
;
95 virtual void SetToolTip(const string16
& tool_tip
) OVERRIDE
;
96 virtual void DisplayBalloon(const gfx::ImageSkia
& icon
,
97 const string16
& title
,
98 const string16
& contents
) OVERRIDE
;
100 virtual void UpdatePlatformContextMenu(
101 StatusIconMenuModel
* menu
) OVERRIDE
;
107 DISALLOW_COPY_AND_ASSIGN(StatusIconMetro
);
110 #endif // CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_ICON_WIN_H_