MacViews: Get c/b/ui/views/tabs to build on Mac
[chromium-blink-merge.git] / chrome / browser / ui / views / status_icons / status_tray_win.h
blobe4271d6e04a293fe84bae400e88afa3ad7ce2bb4
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_
8 #include <windows.h>
10 #include "base/compiler_specific.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "chrome/browser/status_icons/status_tray.h"
14 class StatusIconWin;
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 {
20 public:
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 {
29 public:
30 StatusTrayWin();
31 ~StatusTrayWin();
33 void UpdateIconVisibilityInBackground(StatusIconWin* status_icon);
35 // Exposed for testing.
36 LRESULT CALLBACK
37 WndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
39 protected:
40 // Overriden from StatusTray:
41 virtual StatusIcon* CreatePlatformStatusIcon(StatusIconType type,
42 const gfx::ImageSkia& image,
43 const base::string16& tool_tip)
44 override;
46 private:
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);
53 UINT NextIconId();
55 void SetStatusTrayStateChangerProxyForTest(
56 scoped_ptr<StatusTrayStateChangerProxy> proxy);
58 // The unique icon ID we will assign to the next icon.
59 UINT next_icon_id_;
61 // The window class of |window_|.
62 ATOM atom_;
64 // The handle of the module that contains the window procedure of |window_|.
65 HMODULE instance_;
67 // The window used for processing events.
68 HWND window_;
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_