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

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: rebased. 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
« 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 virtual ~EventExecutorMac() {} 50 virtual ~EventExecutorMac() {}
51 51
52 // ClipboardStub interface. 52 // ClipboardStub interface.
53 virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE; 53 virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE;
54 54
55 // InputStub interface. 55 // InputStub interface.
56 virtual void InjectKeyEvent(const KeyEvent& event) OVERRIDE; 56 virtual void InjectKeyEvent(const KeyEvent& event) OVERRIDE;
57 virtual void InjectMouseEvent(const MouseEvent& event) OVERRIDE; 57 virtual void InjectMouseEvent(const MouseEvent& event) OVERRIDE;
58 58
59 // EventExecutor interface. 59 // EventExecutor interface.
60 virtual void OnSessionStarted( 60 virtual void Start(
61 scoped_ptr<protocol::ClipboardStub> client_clipboard) OVERRIDE; 61 scoped_ptr<protocol::ClipboardStub> client_clipboard) OVERRIDE;
62 virtual void OnSessionFinished() OVERRIDE; 62 virtual void StopAndDelete() OVERRIDE;
63 63
64 private: 64 private:
65 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 65 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
66 SkIPoint mouse_pos_; 66 SkIPoint mouse_pos_;
67 uint32 mouse_button_state_; 67 uint32 mouse_button_state_;
68 scoped_ptr<Clipboard> clipboard_; 68 scoped_ptr<Clipboard> clipboard_;
69 69
70 DISALLOW_COPY_AND_ASSIGN(EventExecutorMac); 70 DISALLOW_COPY_AND_ASSIGN(EventExecutorMac);
71 }; 71 };
72 72
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 #pragma clang diagnostic push 397 #pragma clang diagnostic push
398 #pragma clang diagnostic ignored "-Wdeprecated-declarations" 398 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
399 error = CGPostScrollWheelEvent(2, dy, dx); 399 error = CGPostScrollWheelEvent(2, dy, dx);
400 #pragma clang diagnostic pop 400 #pragma clang diagnostic pop
401 if (error != kCGErrorSuccess) { 401 if (error != kCGErrorSuccess) {
402 LOG(WARNING) << "CGPostScrollWheelEvent error " << error; 402 LOG(WARNING) << "CGPostScrollWheelEvent error " << error;
403 } 403 }
404 } 404 }
405 } 405 }
406 406
407 void EventExecutorMac::OnSessionStarted( 407 void EventExecutorMac::Start(
408 scoped_ptr<protocol::ClipboardStub> client_clipboard) { 408 scoped_ptr<protocol::ClipboardStub> client_clipboard) {
409 if (!task_runner_->BelongsToCurrentThread()) { 409 if (!task_runner_->BelongsToCurrentThread()) {
410 task_runner_->PostTask( 410 task_runner_->PostTask(
411 FROM_HERE, 411 FROM_HERE,
412 base::Bind(&EventExecutorMac::OnSessionStarted, 412 base::Bind(&EventExecutorMac::Start,
413 base::Unretained(this), 413 base::Unretained(this),
414 base::Passed(&client_clipboard))); 414 base::Passed(&client_clipboard)));
415 return; 415 return;
416 } 416 }
417 417
418 clipboard_->Start(client_clipboard.Pass()); 418 clipboard_->Start(client_clipboard.Pass());
419 } 419 }
420 420
421 void EventExecutorMac::OnSessionFinished() { 421 void EventExecutorMac::StopAndDelete() {
422 if (!task_runner_->BelongsToCurrentThread()) { 422 if (!task_runner_->BelongsToCurrentThread()) {
423 task_runner_->PostTask( 423 task_runner_->PostTask(
424 FROM_HERE, 424 FROM_HERE,
425 base::Bind(&EventExecutorMac::OnSessionFinished, 425 base::Bind(&EventExecutorMac::StopAndDelete,
426 base::Unretained(this))); 426 base::Unretained(this)));
427 return; 427 return;
428 } 428 }
429 429
430 clipboard_->Stop(); 430 clipboard_->Stop();
431 delete this;
431 } 432 }
432 433
433 } // namespace 434 } // namespace
434 435
435 scoped_ptr<EventExecutor> EventExecutor::Create( 436 scoped_ptr<EventExecutor> EventExecutor::Create(
436 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 437 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
437 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { 438 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) {
438 return scoped_ptr<EventExecutor>(new EventExecutorMac(main_task_runner)); 439 return scoped_ptr<EventExecutor>(new EventExecutorMac(main_task_runner));
439 } 440 }
440 441
441 } // namespace remoting 442 } // 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