Chromium Code Reviews| 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 #include "chrome/browser/ui/views/status_icons/status_tray_win.h" | 5 #include "chrome/browser/ui/views/status_icons/status_tray_win.h" |
| 6 | 6 |
| 7 #include <commctrl.h> | 7 #include <commctrl.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/threading/non_thread_safe.h" | 10 #include "base/threading/non_thread_safe.h" |
| 11 #include "base/threading/thread.h" | 11 #include "base/threading/thread.h" |
| 12 #include "base/win/wrapped_window_proc.h" | 12 #include "base/win/wrapped_window_proc.h" |
| 13 #include "chrome/browser/ui/views/status_icons/status_icon_win.h" | 13 #include "chrome/browser/ui/views/status_icons/status_icon_win.h" |
| 14 #include "chrome/browser/ui/views/status_icons/status_tray_state_changer_win.h" | 14 #include "chrome/browser/ui/views/status_icons/status_tray_state_changer_win.h" |
| 15 #include "chrome/common/chrome_constants.h" | 15 #include "chrome/common/chrome_constants.h" |
| 16 #include "ui/gfx/screen.h" | 16 #include "ui/gfx/screen.h" |
| 17 #include "ui/gfx/win/hwnd_util.h" | 17 #include "ui/gfx/win/hwnd_util.h" |
| 18 | 18 |
| 19 static const UINT kStatusIconMessage = WM_APP + 1; | 19 static const UINT kStatusIconMessage = WM_APP + 1; |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 // |kBaseIconId| is 2 to avoid conflicts with plugins that hard-code id 1. | 22 // |kBaseIconId| is 2 to avoid conflicts with plugins that hard-code id 1. |
| 23 const UINT kBaseIconId = 2; | 23 const UINT kBaseIconId = 2; |
| 24 | 24 |
| 25 UINT ReservedIconId(StatusTray::StatusIconType type) { | 25 UINT ReservedIconId(StatusTray::StatusIconType type) { |
| 26 return kBaseIconId + static_cast<UINT>(type); | 26 return kBaseIconId + static_cast<UINT>(type); |
| 27 } | 27 } |
| 28 } // namespace | 28 } // namespace |
| 29 | 29 |
| 30 StatusTrayStateChangerProxy::~StatusTrayStateChangerProxy() { | |
|
sky
2014/07/18 23:06:59
I would inline this.
Nico
2014/07/19 00:24:12
Done. (On posix, having an out-of-line destructor
| |
| 31 } | |
| 32 | |
| 30 // Default implementation for StatusTrayStateChanger that communicates to | 33 // Default implementation for StatusTrayStateChanger that communicates to |
| 31 // Exporer.exe via COM. It spawns a background thread with a fresh COM | 34 // Exporer.exe via COM. It spawns a background thread with a fresh COM |
| 32 // apartment and requests that the visibility be increased unless the user | 35 // apartment and requests that the visibility be increased unless the user |
| 33 // has explicitly set the icon to be hidden. | 36 // has explicitly set the icon to be hidden. |
| 34 class StatusTrayStateChangerProxyImpl : public StatusTrayStateChangerProxy, | 37 class StatusTrayStateChangerProxyImpl : public StatusTrayStateChangerProxy, |
| 35 public base::NonThreadSafe { | 38 public base::NonThreadSafe { |
| 36 public: | 39 public: |
| 37 StatusTrayStateChangerProxyImpl() | 40 StatusTrayStateChangerProxyImpl() |
| 38 : pending_requests_(0), | 41 : pending_requests_(0), |
| 39 worker_thread_("StatusIconCOMWorkerThread"), | 42 worker_thread_("StatusIconCOMWorkerThread"), |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 } | 224 } |
| 222 | 225 |
| 223 void StatusTrayWin::SetStatusTrayStateChangerProxyForTest( | 226 void StatusTrayWin::SetStatusTrayStateChangerProxyForTest( |
| 224 scoped_ptr<StatusTrayStateChangerProxy> proxy) { | 227 scoped_ptr<StatusTrayStateChangerProxy> proxy) { |
| 225 state_changer_proxy_ = proxy.Pass(); | 228 state_changer_proxy_ = proxy.Pass(); |
| 226 } | 229 } |
| 227 | 230 |
| 228 StatusTray* StatusTray::Create() { | 231 StatusTray* StatusTray::Create() { |
| 229 return new StatusTrayWin(); | 232 return new StatusTrayWin(); |
| 230 } | 233 } |
| OLD | NEW |