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

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

Issue 12544019: Create a desktop environment instance late so that it will see the curtain_required flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CR feedback. Created 7 years, 9 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/client_session.h ('k') | remoting/host/client_session_unittest.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/client_session.h" 5 #include "remoting/host/client_session.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/message_loop_proxy.h" 9 #include "base/message_loop_proxy.h"
10 #include "media/video/capture/screen/screen_capturer.h" 10 #include "media/video/capture/screen/screen_capturer.h"
(...skipping 30 matching lines...) Expand all
41 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner, 41 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner,
42 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, 42 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
43 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, 43 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
44 scoped_ptr<protocol::ConnectionToClient> connection, 44 scoped_ptr<protocol::ConnectionToClient> connection,
45 DesktopEnvironmentFactory* desktop_environment_factory, 45 DesktopEnvironmentFactory* desktop_environment_factory,
46 const base::TimeDelta& max_duration) 46 const base::TimeDelta& max_duration)
47 : event_handler_(event_handler), 47 : event_handler_(event_handler),
48 connection_(connection.Pass()), 48 connection_(connection.Pass()),
49 connection_factory_(connection_.get()), 49 connection_factory_(connection_.get()),
50 client_jid_(connection_->session()->jid()), 50 client_jid_(connection_->session()->jid()),
51 // TODO(alexeypa): delay creation of |desktop_environment_| until 51 desktop_environment_factory_(desktop_environment_factory),
52 // the curtain is enabled.
53 desktop_environment_(desktop_environment_factory->Create(
54 client_jid_,
55 base::Bind(&protocol::ConnectionToClient::Disconnect,
56 connection_factory_.GetWeakPtr()))),
57 input_tracker_(&host_input_filter_), 52 input_tracker_(&host_input_filter_),
58 remote_input_filter_(&input_tracker_), 53 remote_input_filter_(&input_tracker_),
59 mouse_clamping_filter_(&remote_input_filter_), 54 mouse_clamping_filter_(&remote_input_filter_),
60 disable_input_filter_(mouse_clamping_filter_.input_filter()), 55 disable_input_filter_(mouse_clamping_filter_.input_filter()),
61 disable_clipboard_filter_(clipboard_echo_filter_.host_filter()), 56 disable_clipboard_filter_(clipboard_echo_filter_.host_filter()),
62 auth_input_filter_(&disable_input_filter_), 57 auth_input_filter_(&disable_input_filter_),
63 auth_clipboard_filter_(&disable_clipboard_filter_), 58 auth_clipboard_filter_(&disable_clipboard_filter_),
64 client_clipboard_factory_(clipboard_echo_filter_.client_filter()), 59 client_clipboard_factory_(clipboard_echo_filter_.client_filter()),
65 max_duration_(max_duration), 60 max_duration_(max_duration),
66 audio_task_runner_(audio_task_runner), 61 audio_task_runner_(audio_task_runner),
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 149
155 void ClientSession::OnConnectionChannelsConnected( 150 void ClientSession::OnConnectionChannelsConnected(
156 protocol::ConnectionToClient* connection) { 151 protocol::ConnectionToClient* connection) {
157 DCHECK(CalledOnValidThread()); 152 DCHECK(CalledOnValidThread());
158 DCHECK_EQ(connection_.get(), connection); 153 DCHECK_EQ(connection_.get(), connection);
159 DCHECK(!audio_scheduler_); 154 DCHECK(!audio_scheduler_);
160 DCHECK(!event_executor_); 155 DCHECK(!event_executor_);
161 DCHECK(!session_controller_); 156 DCHECK(!session_controller_);
162 DCHECK(!video_scheduler_); 157 DCHECK(!video_scheduler_);
163 158
159 scoped_ptr<DesktopEnvironment> desktop_environment =
160 desktop_environment_factory_->Create(
161 client_jid_,
162 base::Bind(&protocol::ConnectionToClient::Disconnect,
163 connection_factory_.GetWeakPtr()));
164
164 // Create the session controller. 165 // Create the session controller.
165 session_controller_ = desktop_environment_->CreateSessionController(); 166 session_controller_ = desktop_environment->CreateSessionController();
166 167
167 // Create and start the event executor. 168 // Create and start the event executor.
168 event_executor_ = desktop_environment_->CreateEventExecutor( 169 event_executor_ = desktop_environment->CreateEventExecutor(
169 input_task_runner_, ui_task_runner_); 170 input_task_runner_, ui_task_runner_);
170 event_executor_->Start(CreateClipboardProxy()); 171 event_executor_->Start(CreateClipboardProxy());
171 172
172 // Connect the host clipboard and input stubs. 173 // Connect the host clipboard and input stubs.
173 host_input_filter_.set_input_stub(event_executor_.get()); 174 host_input_filter_.set_input_stub(event_executor_.get());
174 clipboard_echo_filter_.set_host_stub(event_executor_.get()); 175 clipboard_echo_filter_.set_host_stub(event_executor_.get());
175 176
176 SetDisableInputs(false); 177 SetDisableInputs(false);
177 178
178 // Create a VideoEncoder based on the session's video channel configuration. 179 // Create a VideoEncoder based on the session's video channel configuration.
179 scoped_ptr<VideoEncoder> video_encoder = 180 scoped_ptr<VideoEncoder> video_encoder =
180 CreateVideoEncoder(connection_->session()->config()); 181 CreateVideoEncoder(connection_->session()->config());
181 182
182 // Create a VideoScheduler to pump frames from the capturer to the client. 183 // Create a VideoScheduler to pump frames from the capturer to the client.
183 video_scheduler_ = VideoScheduler::Create( 184 video_scheduler_ = VideoScheduler::Create(
184 video_capture_task_runner_, 185 video_capture_task_runner_,
185 video_encode_task_runner_, 186 video_encode_task_runner_,
186 network_task_runner_, 187 network_task_runner_,
187 desktop_environment_->CreateVideoCapturer(video_capture_task_runner_, 188 desktop_environment->CreateVideoCapturer(video_capture_task_runner_,
188 video_encode_task_runner_), 189 video_encode_task_runner_),
189 video_encoder.Pass(), 190 video_encoder.Pass(),
190 connection_->client_stub(), 191 connection_->client_stub(),
191 &mouse_clamping_filter_); 192 &mouse_clamping_filter_);
192 193
193 // Create an AudioScheduler if audio is enabled, to pump audio samples. 194 // Create an AudioScheduler if audio is enabled, to pump audio samples.
194 if (connection_->session()->config().is_audio_enabled()) { 195 if (connection_->session()->config().is_audio_enabled()) {
195 scoped_ptr<AudioEncoder> audio_encoder = 196 scoped_ptr<AudioEncoder> audio_encoder =
196 CreateAudioEncoder(connection_->session()->config()); 197 CreateAudioEncoder(connection_->session()->config());
197 audio_scheduler_ = AudioScheduler::Create( 198 audio_scheduler_ = AudioScheduler::Create(
198 audio_task_runner_, 199 audio_task_runner_,
199 network_task_runner_, 200 network_task_runner_,
200 desktop_environment_->CreateAudioCapturer(audio_task_runner_), 201 desktop_environment->CreateAudioCapturer(audio_task_runner_),
201 audio_encoder.Pass(), 202 audio_encoder.Pass(),
202 connection_->audio_stub()); 203 connection_->audio_stub());
203 } 204 }
204 205
205 // Notify the event handler that all our channels are now connected. 206 // Notify the event handler that all our channels are now connected.
206 event_handler_->OnSessionChannelsConnected(this); 207 event_handler_->OnSessionChannelsConnected(this);
207 } 208 }
208 209
209 void ClientSession::OnConnectionClosed( 210 void ClientSession::OnConnectionClosed(
210 protocol::ConnectionToClient* connection, 211 protocol::ConnectionToClient* connection,
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 return scoped_ptr<AudioEncoder>(new AudioEncoderSpeex()); 331 return scoped_ptr<AudioEncoder>(new AudioEncoderSpeex());
331 } else if (audio_config.codec == protocol::ChannelConfig::CODEC_OPUS) { 332 } else if (audio_config.codec == protocol::ChannelConfig::CODEC_OPUS) {
332 return scoped_ptr<AudioEncoder>(new AudioEncoderOpus()); 333 return scoped_ptr<AudioEncoder>(new AudioEncoderOpus());
333 } 334 }
334 335
335 NOTIMPLEMENTED(); 336 NOTIMPLEMENTED();
336 return scoped_ptr<AudioEncoder>(NULL); 337 return scoped_ptr<AudioEncoder>(NULL);
337 } 338 }
338 339
339 } // namespace remoting 340 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/client_session.h ('k') | remoting/host/client_session_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698