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 // Called by StatusTrayWin to request upgraded visibility on the icon
22 // represented by the |icon_id|, |window| pair.
23 virtual void EnqueueChange(UINT icon_id
, HWND window
) = 0;
26 class StatusTrayWin
: public StatusTray
{
31 void UpdateIconVisibilityInBackground(StatusIconWin
* status_icon
);
33 // Exposed for testing.
35 WndProc(HWND hwnd
, UINT message
, WPARAM wparam
, LPARAM lparam
);
38 // Overriden from StatusTray:
39 virtual StatusIcon
* CreatePlatformStatusIcon(StatusIconType type
,
40 const gfx::ImageSkia
& image
,
41 const base::string16
& tool_tip
)
45 FRIEND_TEST_ALL_PREFIXES(StatusTrayWinTest
, EnsureVisibleTest
);
47 // Static callback invoked when a message comes in to our messaging window.
48 static LRESULT CALLBACK
49 WndProcStatic(HWND hwnd
, UINT message
, WPARAM wparam
, LPARAM lparam
);
53 void SetStatusTrayStateChangerProxyForTest(
54 scoped_ptr
<StatusTrayStateChangerProxy
> proxy
);
56 // The unique icon ID we will assign to the next icon.
59 // The window class of |window_|.
62 // The handle of the module that contains the window procedure of |window_|.
65 // The window used for processing events.
68 // The message ID of the "TaskbarCreated" message, sent to us when we need to
69 // reset our status icons.
70 UINT taskbar_created_message_
;
72 // Manages changes performed on a background thread to manipulate visibility
73 // of notification icons.
74 scoped_ptr
<StatusTrayStateChangerProxy
> state_changer_proxy_
;
76 DISALLOW_COPY_AND_ASSIGN(StatusTrayWin
);
79 #endif // CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_TRAY_WIN_H_