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

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

Issue 10920019: [Chromoting] Refactoring DesktopEnvironment and moving screen/audio recorders to ClientSession. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CR feedback. Created 8 years, 3 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
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 27 matching lines...) Expand all
38 virtual ~EventExecutorMac() {} 38 virtual ~EventExecutorMac() {}
39 39
40 // ClipboardStub interface. 40 // ClipboardStub interface.
41 virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE; 41 virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE;
42 42
43 // InputStub interface. 43 // InputStub interface.
44 virtual void InjectKeyEvent(const KeyEvent& event) OVERRIDE; 44 virtual void InjectKeyEvent(const KeyEvent& event) OVERRIDE;
45 virtual void InjectMouseEvent(const MouseEvent& event) OVERRIDE; 45 virtual void InjectMouseEvent(const MouseEvent& event) OVERRIDE;
46 46
47 // EventExecutor interface. 47 // EventExecutor interface.
48 virtual void OnSessionStarted( 48 virtual void Start(
49 scoped_ptr<protocol::ClipboardStub> client_clipboard) OVERRIDE; 49 scoped_ptr<protocol::ClipboardStub> client_clipboard) OVERRIDE;
50 virtual void OnSessionFinished() OVERRIDE; 50 virtual void StopAndDelete() OVERRIDE;
51 51
52 private: 52 private:
53 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 53 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
54 SkIPoint mouse_pos_; 54 SkIPoint mouse_pos_;
55 uint32 mouse_button_state_; 55 uint32 mouse_button_state_;
56 scoped_ptr<Clipboard> clipboard_; 56 scoped_ptr<Clipboard> clipboard_;
57 57
58 DISALLOW_COPY_AND_ASSIGN(EventExecutorMac); 58 DISALLOW_COPY_AND_ASSIGN(EventExecutorMac);
59 }; 59 };
60 60
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 #pragma clang diagnostic push 356 #pragma clang diagnostic push
357 #pragma clang diagnostic ignored "-Wdeprecated-declarations" 357 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
358 error = CGPostScrollWheelEvent(2, dy, dx); 358 error = CGPostScrollWheelEvent(2, dy, dx);
359 #pragma clang diagnostic pop 359 #pragma clang diagnostic pop
360 if (error != kCGErrorSuccess) { 360 if (error != kCGErrorSuccess) {
361 LOG(WARNING) << "CGPostScrollWheelEvent error " << error; 361 LOG(WARNING) << "CGPostScrollWheelEvent error " << error;
362 } 362 }
363 } 363 }
364 } 364 }
365 365
366 void EventExecutorMac::OnSessionStarted( 366 void EventExecutorMac::Start(
367 scoped_ptr<protocol::ClipboardStub> client_clipboard) { 367 scoped_ptr<protocol::ClipboardStub> client_clipboard) {
368 if (!task_runner_->BelongsToCurrentThread()) { 368 if (!task_runner_->BelongsToCurrentThread()) {
369 task_runner_->PostTask( 369 task_runner_->PostTask(
370 FROM_HERE, 370 FROM_HERE,
371 base::Bind(&EventExecutorMac::OnSessionStarted, 371 base::Bind(&EventExecutorMac::Start,
372 base::Unretained(this), 372 base::Unretained(this),
373 base::Passed(&client_clipboard))); 373 base::Passed(&client_clipboard)));
374 return; 374 return;
375 } 375 }
376 376
377 clipboard_->Start(client_clipboard.Pass()); 377 clipboard_->Start(client_clipboard.Pass());
378 } 378 }
379 379
380 void EventExecutorMac::OnSessionFinished() { 380 void EventExecutorMac::StopAndDelete() {
381 if (!task_runner_->BelongsToCurrentThread()) { 381 if (!task_runner_->BelongsToCurrentThread()) {
382 task_runner_->PostTask( 382 task_runner_->PostTask(
383 FROM_HERE, 383 FROM_HERE,
384 base::Bind(&EventExecutorMac::OnSessionFinished, 384 base::Bind(&EventExecutorMac::StopAndDelete,
385 base::Unretained(this))); 385 base::Unretained(this)));
386 return; 386 return;
387 } 387 }
388 388
389 clipboard_->Stop(); 389 clipboard_->Stop();
390 delete this;
390 } 391 }
391 392
392 } // namespace 393 } // namespace
393 394
394 scoped_ptr<EventExecutor> EventExecutor::Create( 395 scoped_ptr<EventExecutor> EventExecutor::Create(
395 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 396 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
396 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { 397 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) {
397 return scoped_ptr<EventExecutor>(new EventExecutorMac(main_task_runner)); 398 return scoped_ptr<EventExecutor>(new EventExecutorMac(main_task_runner));
398 } 399 }
399 400
400 } // namespace remoting 401 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698