| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_TRAY_WIN_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_TRAY_WIN_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_TRAY_WIN_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_TRAY_WIN_H_ |
| 7 | 7 |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/memory/scoped_ptr.h" |
| 11 #include "chrome/browser/status_icons/status_tray.h" | 12 #include "chrome/browser/status_icons/status_tray.h" |
| 12 | 13 |
| 14 class StatusIconWin; |
| 15 class StatusTrayStateChangerProxy { |
| 16 public: |
| 17 virtual void EnqueueChange(UINT icon_id, HWND window) = 0; |
| 18 }; |
| 19 |
| 13 class StatusTrayWin : public StatusTray { | 20 class StatusTrayWin : public StatusTray { |
| 14 public: | 21 public: |
| 15 StatusTrayWin(); | 22 StatusTrayWin(); |
| 16 ~StatusTrayWin(); | 23 ~StatusTrayWin(); |
| 17 | 24 |
| 25 void UpdateIconVisibilityInBackground(StatusIconWin* status_icon); |
| 26 |
| 18 // Exposed for testing. | 27 // Exposed for testing. |
| 19 LRESULT CALLBACK WndProc(HWND hwnd, | 28 LRESULT CALLBACK |
| 20 UINT message, | 29 WndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); |
| 21 WPARAM wparam, | |
| 22 LPARAM lparam); | |
| 23 | 30 |
| 24 protected: | 31 protected: |
| 25 // Overriden from StatusTray: | 32 // Overriden from StatusTray: |
| 26 virtual StatusIcon* CreatePlatformStatusIcon( | 33 virtual StatusIcon* CreatePlatformStatusIcon(StatusIconType type, |
| 27 StatusIconType type, | 34 const gfx::ImageSkia& image, |
| 28 const gfx::ImageSkia& image, | 35 const base::string16& tool_tip) |
| 29 const base::string16& tool_tip) OVERRIDE; | 36 OVERRIDE; |
| 30 | 37 |
| 31 private: | 38 private: |
| 39 FRIEND_TEST_ALL_PREFIXES(StatusTrayWinTest, EnsureVisibleTest); |
| 40 |
| 32 // Static callback invoked when a message comes in to our messaging window. | 41 // Static callback invoked when a message comes in to our messaging window. |
| 33 static LRESULT CALLBACK WndProcStatic(HWND hwnd, | 42 static LRESULT CALLBACK |
| 34 UINT message, | 43 WndProcStatic(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); |
| 35 WPARAM wparam, | |
| 36 LPARAM lparam); | |
| 37 | 44 |
| 38 UINT NextIconId(); | 45 UINT NextIconId(); |
| 39 | 46 |
| 47 void SetStatusTrayStateChangerProxyForTest( |
| 48 scoped_ptr<StatusTrayStateChangerProxy> proxy); |
| 49 |
| 40 // The unique icon ID we will assign to the next icon. | 50 // The unique icon ID we will assign to the next icon. |
| 41 UINT next_icon_id_; | 51 UINT next_icon_id_; |
| 42 | 52 |
| 43 // The window class of |window_|. | 53 // The window class of |window_|. |
| 44 ATOM atom_; | 54 ATOM atom_; |
| 45 | 55 |
| 46 // The handle of the module that contains the window procedure of |window_|. | 56 // The handle of the module that contains the window procedure of |window_|. |
| 47 HMODULE instance_; | 57 HMODULE instance_; |
| 48 | 58 |
| 49 // The window used for processing events. | 59 // The window used for processing events. |
| 50 HWND window_; | 60 HWND window_; |
| 51 | 61 |
| 52 // The message ID of the "TaskbarCreated" message, sent to us when we need to | 62 // The message ID of the "TaskbarCreated" message, sent to us when we need to |
| 53 // reset our status icons. | 63 // reset our status icons. |
| 54 UINT taskbar_created_message_; | 64 UINT taskbar_created_message_; |
| 55 | 65 |
| 66 // Manages changes performed on a background thread to manipulate visibility |
| 67 // of notification icons. |
| 68 scoped_ptr<StatusTrayStateChangerProxy> state_changer_proxy_; |
| 69 |
| 56 DISALLOW_COPY_AND_ASSIGN(StatusTrayWin); | 70 DISALLOW_COPY_AND_ASSIGN(StatusTrayWin); |
| 57 }; | 71 }; |
| 58 | 72 |
| 59 #endif // CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_TRAY_WIN_H_ | 73 #endif // CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_TRAY_WIN_H_ |
| 60 | 74 |
| OLD | NEW |