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_TRAY_WIN_H_
6 #define CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_TRAY_WIN_H_
10 #include "base/compiler_specific.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "chrome/browser/status_icons/status_tray.h"
16 // A class that's responsible for increasing, if possible, the visibility
17 // of a status tray icon on the taskbar. The default implementation sends
18 // a task to a worker thread each time EnqueueChange is called.
19 class StatusTrayStateChangerProxy
{
21 virtual ~StatusTrayStateChangerProxy() {}
23 // Called by StatusTrayWin to request upgraded visibility on the icon
24 // represented by the |icon_id|, |window| pair.
25 virtual void EnqueueChange(UINT icon_id
, HWND window
) = 0;
28 class StatusTrayWin
: public StatusTray
{
31 ~StatusTrayWin() override
;
33 void UpdateIconVisibilityInBackground(StatusIconWin
* status_icon
);
35 // Exposed for testing.
37 WndProc(HWND hwnd
, UINT message
, WPARAM wparam
, LPARAM lparam
);
40 // Overriden from StatusTray:
41 StatusIcon
* CreatePlatformStatusIcon(StatusIconType type
,
42 const gfx::ImageSkia
& image
,
43 const base::string16
& tool_tip
) override
;
46 FRIEND_TEST_ALL_PREFIXES(StatusTrayWinTest
, EnsureVisibleTest
);
48 // Static callback invoked when a message comes in to our messaging window.
49 static LRESULT CALLBACK
50 WndProcStatic(HWND hwnd
, UINT message
, WPARAM wparam
, LPARAM lparam
);
54 void SetStatusTrayStateChangerProxyForTest(
55 scoped_ptr
<StatusTrayStateChangerProxy
> proxy
);
57 // The unique icon ID we will assign to the next icon.
60 // The window class of |window_|.
63 // The handle of the module that contains the window procedure of |window_|.
66 // The window used for processing events.
69 // The message ID of the "TaskbarCreated" message, sent to us when we need to
70 // reset our status icons.
71 UINT taskbar_created_message_
;
73 // Manages changes performed on a background thread to manipulate visibility
74 // of notification icons.
75 scoped_ptr
<StatusTrayStateChangerProxy
> state_changer_proxy_
;
77 DISALLOW_COPY_AND_ASSIGN(StatusTrayWin
);
80 #endif // CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_TRAY_WIN_H_