| 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 "remoting/host/event_executor.h" | 5 #include "remoting/host/event_executor.h" |
| 6 | 6 |
| 7 #include <ApplicationServices/ApplicationServices.h> | 7 #include <ApplicationServices/ApplicationServices.h> |
| 8 #include <Carbon/Carbon.h> | 8 #include <Carbon/Carbon.h> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 // HostEventDispatcher should filter events missing the pressed field. | 154 // HostEventDispatcher should filter events missing the pressed field. |
| 155 DCHECK(event.has_pressed()); | 155 DCHECK(event.has_pressed()); |
| 156 DCHECK(event.has_usb_keycode()); | 156 DCHECK(event.has_usb_keycode()); |
| 157 | 157 |
| 158 int keycode = UsbKeycodeToNativeKeycode(event.usb_keycode()); | 158 int keycode = UsbKeycodeToNativeKeycode(event.usb_keycode()); |
| 159 | 159 |
| 160 VLOG(3) << "Converting USB keycode: " << std::hex << event.usb_keycode() | 160 VLOG(3) << "Converting USB keycode: " << std::hex << event.usb_keycode() |
| 161 << " to keycode: " << keycode << std::dec; | 161 << " to keycode: " << keycode << std::dec; |
| 162 | 162 |
| 163 // If we couldn't determine the Mac virtual key code then ignore the event. | 163 // If we couldn't determine the Mac virtual key code then ignore the event. |
| 164 if (keycode == kInvalidKeycode) | 164 if (keycode == InvalidNativeKeycode()) |
| 165 return; | 165 return; |
| 166 | 166 |
| 167 // We use the deprecated event injection API because the new one doesn't | 167 // We use the deprecated event injection API because the new one doesn't |
| 168 // work with switched-out sessions (curtain mode). | 168 // work with switched-out sessions (curtain mode). |
| 169 #pragma clang diagnostic push | 169 #pragma clang diagnostic push |
| 170 #pragma clang diagnostic ignored "-Wdeprecated-declarations" | 170 #pragma clang diagnostic ignored "-Wdeprecated-declarations" |
| 171 CGError error = CGPostKeyboardEvent(0, keycode, event.pressed()); | 171 CGError error = CGPostKeyboardEvent(0, keycode, event.pressed()); |
| 172 #pragma clang diagnostic pop | 172 #pragma clang diagnostic pop |
| 173 if (error != kCGErrorSuccess) { | 173 if (error != kCGErrorSuccess) { |
| 174 LOG(WARNING) << "CGPostKeyboardEvent error " << error; | 174 LOG(WARNING) << "CGPostKeyboardEvent error " << error; |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 | 281 |
| 282 } // namespace | 282 } // namespace |
| 283 | 283 |
| 284 scoped_ptr<EventExecutor> EventExecutor::Create( | 284 scoped_ptr<EventExecutor> EventExecutor::Create( |
| 285 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 285 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 286 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { | 286 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { |
| 287 return scoped_ptr<EventExecutor>(new EventExecutorMac(main_task_runner)); | 287 return scoped_ptr<EventExecutor>(new EventExecutorMac(main_task_runner)); |
| 288 } | 288 } |
| 289 | 289 |
| 290 } // namespace remoting | 290 } // namespace remoting |
| OLD | NEW |