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

Side by Side Diff: remoting/host/win/session_event_executor.cc

Issue 10915206: [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/win/session_event_executor.h ('k') | remoting/protocol/protocol_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/session_event_executor_win.h" 5 #include "remoting/host/win/session_event_executor.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/location.h" 11 #include "base/location.h"
12 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
13 #include "base/win/windows_version.h" 13 #include "base/win/windows_version.h"
14 #include "remoting/host/sas_injector.h" 14 #include "remoting/host/sas_injector.h"
15 #include "remoting/host/win/desktop.h" 15 #include "remoting/host/win/desktop.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 weak_ptr_(weak_ptr_factory_.GetWeakPtr()) { 49 weak_ptr_(weak_ptr_factory_.GetWeakPtr()) {
50 // Let |weak_ptr_| be used on the |task_runner_| thread. 50 // Let |weak_ptr_| be used on the |task_runner_| thread.
51 // |weak_ptr_| and |weak_ptr_factory_| share a ThreadChecker, so the 51 // |weak_ptr_| and |weak_ptr_factory_| share a ThreadChecker, so the
52 // following line affects both of them. 52 // following line affects both of them.
53 weak_ptr_factory_.DetachFromThread(); 53 weak_ptr_factory_.DetachFromThread();
54 } 54 }
55 55
56 SessionEventExecutorWin::~SessionEventExecutorWin() { 56 SessionEventExecutorWin::~SessionEventExecutorWin() {
57 } 57 }
58 58
59 void SessionEventExecutorWin::OnSessionStarted( 59 void SessionEventExecutorWin::Start(
60 scoped_ptr<protocol::ClipboardStub> client_clipboard) { 60 scoped_ptr<protocol::ClipboardStub> client_clipboard) {
61 if (!task_runner_->BelongsToCurrentThread()) { 61 if (!task_runner_->BelongsToCurrentThread()) {
62 task_runner_->PostTask( 62 task_runner_->PostTask(
63 FROM_HERE, 63 FROM_HERE,
64 base::Bind(&SessionEventExecutorWin::OnSessionStarted, 64 base::Bind(&SessionEventExecutorWin::Start,
65 weak_ptr_, base::Passed(&client_clipboard))); 65 weak_ptr_, base::Passed(&client_clipboard)));
66 return; 66 return;
67 } 67 }
68 68
69 nested_executor_->OnSessionStarted(client_clipboard.Pass()); 69 nested_executor_->Start(client_clipboard.Pass());
70 } 70 }
71 71
72 void SessionEventExecutorWin::OnSessionFinished() { 72 void SessionEventExecutorWin::StopAndDelete() {
73 if (!task_runner_->BelongsToCurrentThread()) { 73 if (!task_runner_->BelongsToCurrentThread()) {
74 task_runner_->PostTask( 74 task_runner_->PostTask(
75 FROM_HERE, 75 FROM_HERE,
76 base::Bind(&SessionEventExecutorWin::OnSessionFinished, 76 base::Bind(&SessionEventExecutorWin::StopAndDelete,
77 weak_ptr_)); 77 weak_ptr_));
78 return; 78 return;
79 } 79 }
80 80
81 nested_executor_->OnSessionFinished(); 81 nested_executor_.release()->StopAndDelete();
82 delete this;
82 } 83 }
83 84
84 void SessionEventExecutorWin::InjectClipboardEvent( 85 void SessionEventExecutorWin::InjectClipboardEvent(
85 const ClipboardEvent& event) { 86 const ClipboardEvent& event) {
86 if (!task_runner_->BelongsToCurrentThread()) { 87 if (!task_runner_->BelongsToCurrentThread()) {
87 task_runner_->PostTask( 88 task_runner_->PostTask(
88 FROM_HERE, 89 FROM_HERE,
89 base::Bind(&SessionEventExecutorWin::InjectClipboardEvent, 90 base::Bind(&SessionEventExecutorWin::InjectClipboardEvent,
90 weak_ptr_, event)); 91 weak_ptr_, event));
91 return; 92 return;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 // one. 147 // one.
147 scoped_ptr<Desktop> input_desktop = Desktop::GetInputDesktop(); 148 scoped_ptr<Desktop> input_desktop = Desktop::GetInputDesktop();
148 if (input_desktop.get() != NULL && !desktop_.IsSame(*input_desktop)) { 149 if (input_desktop.get() != NULL && !desktop_.IsSame(*input_desktop)) {
149 // If SetThreadDesktop() fails, the thread is still assigned a desktop. 150 // If SetThreadDesktop() fails, the thread is still assigned a desktop.
150 // So we can continue capture screen bits, just from a diffected desktop. 151 // So we can continue capture screen bits, just from a diffected desktop.
151 desktop_.SetThreadDesktop(input_desktop.Pass()); 152 desktop_.SetThreadDesktop(input_desktop.Pass());
152 } 153 }
153 } 154 }
154 155
155 } // namespace remoting 156 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/win/session_event_executor.h ('k') | remoting/protocol/protocol_mock_objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698