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

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

Issue 10916161: Revert 155219 - [Chromoting] Refactoring DesktopEnvironment and moving screen/audio recorders to Cl… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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_mac.cc ('k') | remoting/host/host_mock_objects.h » ('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 <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
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 Start( 47 virtual void OnSessionStarted(
48 scoped_ptr<protocol::ClipboardStub> client_clipboard) OVERRIDE; 48 scoped_ptr<protocol::ClipboardStub> client_clipboard) OVERRIDE;
49 virtual void StopAndDelete() OVERRIDE; 49 virtual void OnSessionFinished() OVERRIDE;
50 50
51 private: 51 private:
52 HKL GetForegroundKeyboardLayout(); 52 HKL GetForegroundKeyboardLayout();
53 void HandleKey(const KeyEvent& event); 53 void HandleKey(const KeyEvent& event);
54 void HandleMouse(const MouseEvent& event); 54 void HandleMouse(const MouseEvent& event);
55 55
56 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; 56 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
57 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; 57 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
58 scoped_ptr<Clipboard> clipboard_; 58 scoped_ptr<Clipboard> clipboard_;
59 59
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 main_task_runner_->PostTask( 98 main_task_runner_->PostTask(
99 FROM_HERE, 99 FROM_HERE,
100 base::Bind(&EventExecutorWin::InjectMouseEvent, base::Unretained(this), 100 base::Bind(&EventExecutorWin::InjectMouseEvent, base::Unretained(this),
101 event)); 101 event));
102 return; 102 return;
103 } 103 }
104 104
105 HandleMouse(event); 105 HandleMouse(event);
106 } 106 }
107 107
108 void EventExecutorWin::Start( 108 void EventExecutorWin::OnSessionStarted(
109 scoped_ptr<protocol::ClipboardStub> client_clipboard) { 109 scoped_ptr<protocol::ClipboardStub> client_clipboard) {
110 if (!ui_task_runner_->BelongsToCurrentThread()) { 110 if (!ui_task_runner_->BelongsToCurrentThread()) {
111 ui_task_runner_->PostTask( 111 ui_task_runner_->PostTask(
112 FROM_HERE, 112 FROM_HERE,
113 base::Bind(&EventExecutorWin::Start, 113 base::Bind(&EventExecutorWin::OnSessionStarted,
114 base::Unretained(this), 114 base::Unretained(this),
115 base::Passed(&client_clipboard))); 115 base::Passed(&client_clipboard)));
116 return; 116 return;
117 } 117 }
118 118
119 clipboard_->Start(client_clipboard.Pass()); 119 clipboard_->Start(client_clipboard.Pass());
120 } 120 }
121 121
122 void EventExecutorWin::StopAndDelete() { 122 void EventExecutorWin::OnSessionFinished() {
123 if (!ui_task_runner_->BelongsToCurrentThread()) { 123 if (!ui_task_runner_->BelongsToCurrentThread()) {
124 ui_task_runner_->PostTask( 124 ui_task_runner_->PostTask(
125 FROM_HERE, 125 FROM_HERE,
126 base::Bind(&EventExecutorWin::StopAndDelete, 126 base::Bind(&EventExecutorWin::OnSessionFinished,
127 base::Unretained(this))); 127 base::Unretained(this)));
128 return; 128 return;
129 } 129 }
130 130
131 clipboard_->Stop(); 131 clipboard_->Stop();
132 delete this;
133 } 132 }
134 133
135 HKL EventExecutorWin::GetForegroundKeyboardLayout() { 134 HKL EventExecutorWin::GetForegroundKeyboardLayout() {
136 HKL layout = 0; 135 HKL layout = 0;
137 136
138 // Can return NULL if a window is losing focus. 137 // Can return NULL if a window is losing focus.
139 HWND foreground = GetForegroundWindow(); 138 HWND foreground = GetForegroundWindow();
140 if (foreground) { 139 if (foreground) {
141 // Can return 0 if the window no longer exists. 140 // Can return 0 if the window no longer exists.
142 DWORD thread_id = GetWindowThreadProcessId(foreground, 0); 141 DWORD thread_id = GetWindowThreadProcessId(foreground, 0);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 } // namespace 290 } // namespace
292 291
293 scoped_ptr<EventExecutor> EventExecutor::Create( 292 scoped_ptr<EventExecutor> EventExecutor::Create(
294 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 293 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
295 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { 294 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) {
296 return scoped_ptr<EventExecutor>( 295 return scoped_ptr<EventExecutor>(
297 new EventExecutorWin(main_task_runner, ui_task_runner)); 296 new EventExecutorWin(main_task_runner, ui_task_runner));
298 } 297 }
299 298
300 } // namespace remoting 299 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/event_executor_mac.cc ('k') | remoting/host/host_mock_objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698