Infobar material design refresh: layout
[chromium-blink-merge.git] / chrome / browser / ui / views / status_icons / status_tray_win.h
blob260a366c7f88956ac1eb674b4a1ee0b1403c3b9a
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() override;
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 StatusIcon* CreatePlatformStatusIcon(StatusIconType type,
42 const gfx::ImageSkia& image,
43 const base::string16& tool_tip) override;
45 private:
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);
52 UINT NextIconId();
54 void SetStatusTrayStateChangerProxyForTest(
55 scoped_ptr<StatusTrayStateChangerProxy> proxy);
57 // The unique icon ID we will assign to the next icon.
58 UINT next_icon_id_;
60 // The window class of |window_|.
61 ATOM atom_;
63 // The handle of the module that contains the window procedure of |window_|.
64 HMODULE instance_;
66 // The window used for processing events.
67 HWND window_;
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_