| 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 <windows.h> | 7 #include <windows.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 virtual ~EventExecutorWin() {} | 37 virtual ~EventExecutorWin() {} |
| 38 | 38 |
| 39 // ClipboardStub interface. | 39 // ClipboardStub interface. |
| 40 virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE; | 40 virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE; |
| 41 | 41 |
| 42 // InputStub interface. | 42 // InputStub interface. |
| 43 virtual void InjectKeyEvent(const KeyEvent& event) OVERRIDE; | 43 virtual void InjectKeyEvent(const KeyEvent& event) OVERRIDE; |
| 44 virtual void InjectMouseEvent(const MouseEvent& event) OVERRIDE; | 44 virtual void InjectMouseEvent(const MouseEvent& event) OVERRIDE; |
| 45 | 45 |
| 46 // EventExecutor interface. | 46 // EventExecutor interface. |
| 47 virtual void OnSessionStarted() OVERRIDE; | 47 virtual void OnSessionStarted( |
| 48 const scoped_refptr<protocol::ClipboardProxy>& client_clipboard) OVERRIDE; |
| 48 virtual void OnSessionFinished() OVERRIDE; | 49 virtual void OnSessionFinished() OVERRIDE; |
| 49 | 50 |
| 50 private: | 51 private: |
| 51 HKL GetForegroundKeyboardLayout(); | 52 HKL GetForegroundKeyboardLayout(); |
| 52 void HandleKey(const KeyEvent& event); | 53 void HandleKey(const KeyEvent& event); |
| 53 void HandleMouse(const MouseEvent& event); | 54 void HandleMouse(const MouseEvent& event); |
| 54 | 55 |
| 55 MessageLoop* message_loop_; | 56 MessageLoop* message_loop_; |
| 56 base::MessageLoopProxy* ui_loop_; | 57 base::MessageLoopProxy* ui_loop_; |
| 57 Capturer* capturer_; | 58 Capturer* capturer_; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 message_loop_->PostTask( | 100 message_loop_->PostTask( |
| 100 FROM_HERE, | 101 FROM_HERE, |
| 101 base::Bind(&EventExecutorWin::InjectMouseEvent, base::Unretained(this), | 102 base::Bind(&EventExecutorWin::InjectMouseEvent, base::Unretained(this), |
| 102 event)); | 103 event)); |
| 103 return; | 104 return; |
| 104 } | 105 } |
| 105 | 106 |
| 106 HandleMouse(event); | 107 HandleMouse(event); |
| 107 } | 108 } |
| 108 | 109 |
| 109 void EventExecutorWin::OnSessionStarted() { | 110 void EventExecutorWin::OnSessionStarted( |
| 111 const scoped_refptr<protocol::ClipboardProxy>& client_clipboard) { |
| 110 if (!ui_loop_->BelongsToCurrentThread()) { | 112 if (!ui_loop_->BelongsToCurrentThread()) { |
| 111 ui_loop_->PostTask( | 113 ui_loop_->PostTask( |
| 112 FROM_HERE, | 114 FROM_HERE, |
| 113 base::Bind(&EventExecutorWin::OnSessionStarted, | 115 base::Bind(&EventExecutorWin::OnSessionStarted, |
| 114 base::Unretained(this))); | 116 base::Unretained(this), |
| 117 client_clipboard)); |
| 115 return; | 118 return; |
| 116 } | 119 } |
| 117 | 120 |
| 118 clipboard_->Start(); | 121 clipboard_->Start(client_clipboard); |
| 119 } | 122 } |
| 120 | 123 |
| 121 void EventExecutorWin::OnSessionFinished() { | 124 void EventExecutorWin::OnSessionFinished() { |
| 122 if (!ui_loop_->BelongsToCurrentThread()) { | 125 if (!ui_loop_->BelongsToCurrentThread()) { |
| 123 ui_loop_->PostTask( | 126 ui_loop_->PostTask( |
| 124 FROM_HERE, | 127 FROM_HERE, |
| 125 base::Bind(&EventExecutorWin::OnSessionFinished, | 128 base::Bind(&EventExecutorWin::OnSessionFinished, |
| 126 base::Unretained(this))); | 129 base::Unretained(this))); |
| 127 return; | 130 return; |
| 128 } | 131 } |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 } // namespace | 288 } // namespace |
| 286 | 289 |
| 287 scoped_ptr<EventExecutor> EventExecutor::Create(MessageLoop* message_loop, | 290 scoped_ptr<EventExecutor> EventExecutor::Create(MessageLoop* message_loop, |
| 288 base::MessageLoopProxy* ui_loop, | 291 base::MessageLoopProxy* ui_loop, |
| 289 Capturer* capturer) { | 292 Capturer* capturer) { |
| 290 return scoped_ptr<EventExecutor>( | 293 return scoped_ptr<EventExecutor>( |
| 291 new EventExecutorWin(message_loop, ui_loop, capturer)); | 294 new EventExecutorWin(message_loop, ui_loop, capturer)); |
| 292 } | 295 } |
| 293 | 296 |
| 294 } // namespace remoting | 297 } // namespace remoting |
| OLD | NEW |