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" |
(...skipping 23 matching lines...) Expand all Loading... |
34 class StatusTrayStateChangerProxyImpl : public StatusTrayStateChangerProxy, | 34 class StatusTrayStateChangerProxyImpl : public StatusTrayStateChangerProxy, |
35 public base::NonThreadSafe { | 35 public base::NonThreadSafe { |
36 public: | 36 public: |
37 StatusTrayStateChangerProxyImpl() | 37 StatusTrayStateChangerProxyImpl() |
38 : pending_requests_(0), | 38 : pending_requests_(0), |
39 worker_thread_("StatusIconCOMWorkerThread"), | 39 worker_thread_("StatusIconCOMWorkerThread"), |
40 weak_factory_(this) { | 40 weak_factory_(this) { |
41 worker_thread_.init_com_with_mta(false); | 41 worker_thread_.init_com_with_mta(false); |
42 } | 42 } |
43 | 43 |
44 virtual void EnqueueChange(UINT icon_id, HWND window) OVERRIDE { | 44 virtual void EnqueueChange(UINT icon_id, HWND window) override { |
45 DCHECK(CalledOnValidThread()); | 45 DCHECK(CalledOnValidThread()); |
46 if (pending_requests_ == 0) | 46 if (pending_requests_ == 0) |
47 worker_thread_.Start(); | 47 worker_thread_.Start(); |
48 | 48 |
49 ++pending_requests_; | 49 ++pending_requests_; |
50 worker_thread_.message_loop_proxy()->PostTaskAndReply( | 50 worker_thread_.message_loop_proxy()->PostTaskAndReply( |
51 FROM_HERE, | 51 FROM_HERE, |
52 base::Bind( | 52 base::Bind( |
53 &StatusTrayStateChangerProxyImpl::EnqueueChangeOnWorkerThread, | 53 &StatusTrayStateChangerProxyImpl::EnqueueChangeOnWorkerThread, |
54 icon_id, | 54 icon_id, |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 } | 221 } |
222 | 222 |
223 void StatusTrayWin::SetStatusTrayStateChangerProxyForTest( | 223 void StatusTrayWin::SetStatusTrayStateChangerProxyForTest( |
224 scoped_ptr<StatusTrayStateChangerProxy> proxy) { | 224 scoped_ptr<StatusTrayStateChangerProxy> proxy) { |
225 state_changer_proxy_ = proxy.Pass(); | 225 state_changer_proxy_ = proxy.Pass(); |
226 } | 226 } |
227 | 227 |
228 StatusTray* StatusTray::Create() { | 228 StatusTray* StatusTray::Create() { |
229 return new StatusTrayWin(); | 229 return new StatusTrayWin(); |
230 } | 230 } |
OLD | NEW |