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/profiler/scoped_tracker.h" | 10 #include "base/profiler/scoped_tracker.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 class StatusTrayStateChangerProxyImpl : public StatusTrayStateChangerProxy, | 63 class StatusTrayStateChangerProxyImpl : public StatusTrayStateChangerProxy, |
64 public base::NonThreadSafe { | 64 public base::NonThreadSafe { |
65 public: | 65 public: |
66 StatusTrayStateChangerProxyImpl() | 66 StatusTrayStateChangerProxyImpl() |
67 : pending_requests_(0), | 67 : pending_requests_(0), |
68 worker_thread_("StatusIconCOMWorkerThread"), | 68 worker_thread_("StatusIconCOMWorkerThread"), |
69 weak_factory_(this) { | 69 weak_factory_(this) { |
70 worker_thread_.init_com_with_mta(false); | 70 worker_thread_.init_com_with_mta(false); |
71 } | 71 } |
72 | 72 |
73 virtual void EnqueueChange(UINT icon_id, HWND window) override { | 73 void EnqueueChange(UINT icon_id, HWND window) override { |
74 DCHECK(CalledOnValidThread()); | 74 DCHECK(CalledOnValidThread()); |
75 if (pending_requests_ == 0) | 75 if (pending_requests_ == 0) |
76 worker_thread_.Start(); | 76 worker_thread_.Start(); |
77 | 77 |
78 ++pending_requests_; | 78 ++pending_requests_; |
79 worker_thread_.message_loop_proxy()->PostTaskAndReply( | 79 worker_thread_.message_loop_proxy()->PostTaskAndReply( |
80 FROM_HERE, | 80 FROM_HERE, |
81 base::Bind( | 81 base::Bind( |
82 &StatusTrayStateChangerProxyImpl::EnqueueChangeOnWorkerThread, | 82 &StatusTrayStateChangerProxyImpl::EnqueueChangeOnWorkerThread, |
83 icon_id, | 83 icon_id, |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 } | 260 } |
261 | 261 |
262 void StatusTrayWin::SetStatusTrayStateChangerProxyForTest( | 262 void StatusTrayWin::SetStatusTrayStateChangerProxyForTest( |
263 scoped_ptr<StatusTrayStateChangerProxy> proxy) { | 263 scoped_ptr<StatusTrayStateChangerProxy> proxy) { |
264 state_changer_proxy_ = proxy.Pass(); | 264 state_changer_proxy_ = proxy.Pass(); |
265 } | 265 } |
266 | 266 |
267 StatusTray* StatusTray::Create() { | 267 StatusTray* StatusTray::Create() { |
268 return new StatusTrayWin(); | 268 return new StatusTrayWin(); |
269 } | 269 } |
OLD | NEW |