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