OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "remoting/host/local_input_monitor.h" | 5 #include "remoting/host/local_input_monitor.h" |
6 | 6 |
7 #import <AppKit/AppKit.h> | 7 #import <AppKit/AppKit.h> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/mac/scoped_cftyperef.h" | 14 #include "base/mac/scoped_cftyperef.h" |
| 15 #include "base/memory/ref_counted.h" |
15 #include "base/synchronization/lock.h" | 16 #include "base/synchronization/lock.h" |
16 #include "remoting/host/chromoting_host.h" | 17 #include "remoting/host/chromoting_host.h" |
17 #import "third_party/GTM/AppKit/GTMCarbonEvent.h" | 18 #import "third_party/GTM/AppKit/GTMCarbonEvent.h" |
18 | 19 |
19 // Esc Key Code is 53. | 20 // Esc Key Code is 53. |
20 // http://boredzo.org/blog/wp-content/uploads/2007/05/IMTx-virtual-keycodes.pdf | 21 // http://boredzo.org/blog/wp-content/uploads/2007/05/IMTx-virtual-keycodes.pdf |
21 static const NSUInteger kEscKeyCode = 53; | 22 static const NSUInteger kEscKeyCode = 53; |
22 | 23 |
23 namespace { | 24 namespace { |
24 typedef std::set<remoting::ChromotingHost*> Hosts; | 25 typedef std::set<scoped_refptr<remoting::ChromotingHost> > Hosts; |
25 } | 26 } |
26 | 27 |
27 @interface LocalInputMonitorImpl : NSObject { | 28 @interface LocalInputMonitorImpl : NSObject { |
28 @private | 29 @private |
29 GTMCarbonHotKey* hotKey_; | 30 GTMCarbonHotKey* hotKey_; |
30 CFRunLoopSourceRef mouseRunLoopSource_; | 31 CFRunLoopSourceRef mouseRunLoopSource_; |
31 base::mac::ScopedCFTypeRef<CFMachPortRef> mouseMachPort_; | 32 base::mac::ScopedCFTypeRef<CFMachPortRef> mouseMachPort_; |
32 base::Lock hostsLock_; | 33 base::Lock hostsLock_; |
33 Hosts hosts_; | 34 Hosts hosts_; |
34 } | 35 } |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 if ([local_input_monitor removeHost:host_]) { | 182 if ([local_input_monitor removeHost:host_]) { |
182 [local_input_monitor invalidate]; | 183 [local_input_monitor invalidate]; |
183 [local_input_monitor release]; | 184 [local_input_monitor release]; |
184 local_input_monitor = nil; | 185 local_input_monitor = nil; |
185 } | 186 } |
186 } | 187 } |
187 | 188 |
188 remoting::LocalInputMonitor* remoting::LocalInputMonitor::Create() { | 189 remoting::LocalInputMonitor* remoting::LocalInputMonitor::Create() { |
189 return new LocalInputMonitorMac; | 190 return new LocalInputMonitorMac; |
190 } | 191 } |
OLD | NEW |