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
{
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 virtual StatusIcon
* CreatePlatformStatusIcon(StatusIconType type
,
42 const gfx::ImageSkia
& image
,
43 const base::string16
& tool_tip
)
47 FRIEND_TEST_ALL_PREFIXES(StatusTrayWinTest
, EnsureVisibleTest
);
49 // Static callback invoked when a message comes in to our messaging window.
50 static LRESULT CALLBACK
51 WndProcStatic(HWND hwnd
, UINT message
, WPARAM wparam
, LPARAM lparam
);
55 void SetStatusTrayStateChangerProxyForTest(
56 scoped_ptr
<StatusTrayStateChangerProxy
> proxy
);
58 // The unique icon ID we will assign to the next icon.
61 // The window class of |window_|.
64 // The handle of the module that contains the window procedure of |window_|.
67 // The window used for processing events.
70 // The message ID of the "TaskbarCreated" message, sent to us when we need to
71 // reset our status icons.
72 UINT taskbar_created_message_
;
74 // Manages changes performed on a background thread to manipulate visibility
75 // of notification icons.
76 scoped_ptr
<StatusTrayStateChangerProxy
> state_changer_proxy_
;
78 DISALLOW_COPY_AND_ASSIGN(StatusTrayWin
);
81 #endif // CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_TRAY_WIN_H_