Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: remoting/host/event_executor_mac.cc

Issue 12320014: Switch Pepper Linux to use shared USB<->native key conversion table. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix missed kInvalidKeycode. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/host/event_executor_linux.cc ('k') | remoting/host/event_executor_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « remoting/host/event_executor_linux.cc ('k') | remoting/host/event_executor_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698