Infobar material design refresh: layout
[chromium-blink-merge.git] / chrome / browser / ui / views / status_icons / status_icon_win.h
blobc2f4ac7b5b10ecbf1e7429bb11494d0a135de374
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_
8 #include <windows.h>
9 #include <shellapi.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"
17 namespace gfx {
18 class Point;
21 namespace views {
22 class MenuRunner;
25 class StatusTrayWin;
27 class StatusIconWin : public StatusIcon {
28 public:
29 // Constructor which provides this icon's unique ID and messaging window.
30 StatusIconWin(StatusTrayWin* tray, UINT id, HWND window, UINT message);
31 ~StatusIconWin() override;
33 // 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,
35 // otherwise displays the context menu if there is one.
36 void HandleClickEvent(const gfx::Point& cursor_pos, bool left_button_click);
38 // Handles a click on the balloon from the user.
39 void HandleBalloonClickEvent();
41 // Re-creates the status tray icon now after the taskbar has been created.
42 void ResetIcon();
44 UINT icon_id() const { return icon_id_; }
45 HWND window() const { return window_; }
46 UINT message_id() const { return message_id_; }
48 // Overridden from StatusIcon:
49 void SetImage(const gfx::ImageSkia& image) override;
50 void SetToolTip(const base::string16& tool_tip) override;
51 void DisplayBalloon(const gfx::ImageSkia& icon,
52 const base::string16& title,
53 const base::string16& contents) override;
54 void ForceVisible() override;
56 protected:
57 // Overridden from StatusIcon:
58 void UpdatePlatformContextMenu(StatusIconMenuModel* menu) override;
60 private:
61 void InitIconData(NOTIFYICONDATA* icon_data);
63 // The tray that owns us. Weak.
64 StatusTrayWin* tray_;
66 // The unique ID corresponding to this icon.
67 UINT icon_id_;
69 // Window used for processing messages from this icon.
70 HWND window_;
72 // The message identifier used for status icon messages.
73 UINT message_id_;
75 // The currently-displayed icon for the window.
76 base::win::ScopedHICON icon_;
78 // The currently-displayed icon for the notification balloon.
79 base::win::ScopedHICON balloon_icon_;
81 // Not owned.
82 ui::MenuModel* menu_model_;
84 // Context menu associated with this icon (if any).
85 scoped_ptr<views::MenuRunner> menu_runner_;
87 DISALLOW_COPY_AND_ASSIGN(StatusIconWin);
90 #endif // CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_ICON_WIN_H_