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

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

Issue 810133003: replace NULL->nullptr in src/remoting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « remoting/host/host_main.cc ('k') | remoting/host/input_injector_x11.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/input_injector.h" 5 #include "remoting/host/input_injector.h"
6 6
7 #include <ApplicationServices/ApplicationServices.h> 7 #include <ApplicationServices/ApplicationServices.h>
8 #include <Carbon/Carbon.h> 8 #include <Carbon/Carbon.h>
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 18 matching lines...) Expand all
29 29
30 void SetOrClearBit(uint64_t &value, uint64_t bit, bool set_bit) { 30 void SetOrClearBit(uint64_t &value, uint64_t bit, bool set_bit) {
31 value = set_bit ? (value | bit) : (value & ~bit); 31 value = set_bit ? (value | bit) : (value & ~bit);
32 } 32 }
33 33
34 void CreateAndPostKeyEvent(int keycode, 34 void CreateAndPostKeyEvent(int keycode,
35 bool pressed, 35 bool pressed,
36 int flags, 36 int flags,
37 const base::string16& unicode) { 37 const base::string16& unicode) {
38 base::ScopedCFTypeRef<CGEventRef> eventRef( 38 base::ScopedCFTypeRef<CGEventRef> eventRef(
39 CGEventCreateKeyboardEvent(NULL, keycode, pressed)); 39 CGEventCreateKeyboardEvent(nullptr, keycode, pressed));
40 if (eventRef) { 40 if (eventRef) {
41 CGEventSetFlags(eventRef, flags); 41 CGEventSetFlags(eventRef, flags);
42 if (!unicode.empty()) 42 if (!unicode.empty())
43 CGEventKeyboardSetUnicodeString(eventRef, unicode.size(), &(unicode[0])); 43 CGEventKeyboardSetUnicodeString(eventRef, unicode.size(), &(unicode[0]));
44 CGEventPost(kCGSessionEventTap, eventRef); 44 CGEventPost(kCGSessionEventTap, eventRef);
45 } 45 }
46 } 46 }
47 47
48 // This value is not defined. Give it the obvious name so that if it is ever 48 // This value is not defined. Give it the obvious name so that if it is ever
49 // added there will be a handy compilation error to remind us to remove this 49 // added there will be a handy compilation error to remind us to remove this
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 (mouse_button_state_ & RightBit) != 0, 296 (mouse_button_state_ & RightBit) != 0,
297 (mouse_button_state_ & MiddleBit) != 0); 297 (mouse_button_state_ & MiddleBit) != 0);
298 #pragma clang diagnostic pop 298 #pragma clang diagnostic pop
299 if (error != kCGErrorSuccess) 299 if (error != kCGErrorSuccess)
300 LOG(WARNING) << "CGPostMouseEvent error " << error; 300 LOG(WARNING) << "CGPostMouseEvent error " << error;
301 301
302 if (event.has_wheel_delta_x() && event.has_wheel_delta_y()) { 302 if (event.has_wheel_delta_x() && event.has_wheel_delta_y()) {
303 int delta_x = static_cast<int>(event.wheel_delta_x()); 303 int delta_x = static_cast<int>(event.wheel_delta_x());
304 int delta_y = static_cast<int>(event.wheel_delta_y()); 304 int delta_y = static_cast<int>(event.wheel_delta_y());
305 base::ScopedCFTypeRef<CGEventRef> event(CGEventCreateScrollWheelEvent( 305 base::ScopedCFTypeRef<CGEventRef> event(CGEventCreateScrollWheelEvent(
306 NULL, kCGScrollEventUnitPixel, 2, delta_y, delta_x)); 306 nullptr, kCGScrollEventUnitPixel, 2, delta_y, delta_x));
307 if (event) 307 if (event)
308 CGEventPost(kCGSessionEventTap, event); 308 CGEventPost(kCGSessionEventTap, event);
309 } 309 }
310 } 310 }
311 311
312 void InputInjectorMac::Core::Start( 312 void InputInjectorMac::Core::Start(
313 scoped_ptr<protocol::ClipboardStub> client_clipboard) { 313 scoped_ptr<protocol::ClipboardStub> client_clipboard) {
314 if (!task_runner_->BelongsToCurrentThread()) { 314 if (!task_runner_->BelongsToCurrentThread()) {
315 task_runner_->PostTask( 315 task_runner_->PostTask(
316 FROM_HERE, 316 FROM_HERE,
(...skipping 17 matching lines...) Expand all
334 334
335 } // namespace 335 } // namespace
336 336
337 scoped_ptr<InputInjector> InputInjector::Create( 337 scoped_ptr<InputInjector> InputInjector::Create(
338 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 338 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
339 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { 339 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) {
340 return make_scoped_ptr(new InputInjectorMac(main_task_runner)); 340 return make_scoped_ptr(new InputInjectorMac(main_task_runner));
341 } 341 }
342 342
343 } // namespace remoting 343 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/host_main.cc ('k') | remoting/host/input_injector_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698