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

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: rebased on top of https://chromiumcodereview.appspot.com/12794004/ 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
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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 147
153 void ClientSession::OnConnectionChannelsConnected( 148 void ClientSession::OnConnectionChannelsConnected(
154 protocol::ConnectionToClient* connection) { 149 protocol::ConnectionToClient* connection) {
155 DCHECK(CalledOnValidThread()); 150 DCHECK(CalledOnValidThread());
156 DCHECK_EQ(connection_.get(), connection); 151 DCHECK_EQ(connection_.get(), connection);
157 DCHECK(!audio_scheduler_); 152 DCHECK(!audio_scheduler_);
158 DCHECK(!event_executor_); 153 DCHECK(!event_executor_);
159 DCHECK(!session_controller_); 154 DCHECK(!session_controller_);
160 DCHECK(!video_scheduler_); 155 DCHECK(!video_scheduler_);
161 156
157 scoped_ptr<DesktopEnvironment> desktop_environment =
158 desktop_environment_factory_->Create(
159 client_jid_,
160 base::Bind(&protocol::ConnectionToClient::Disconnect,
161 connection_factory_.GetWeakPtr()));
Wez 2013/03/14 04:15:54 ClientSession owns the DesktopEnvironment, so can'
alexeypa (please no reviews) 2013/03/14 19:09:06 No, we can't. The callback is passed to DesktopSes
Wez 2013/03/15 00:15:26 That feels like IpcDesktopEnvironment/DesktopSessi
162
162 // Create the session controller. 163 // Create the session controller.
163 session_controller_ = desktop_environment_->CreateSessionController(); 164 session_controller_ = desktop_environment->CreateSessionController();
164 165
165 // Create and start the event executor. 166 // Create and start the event executor.
166 event_executor_ = desktop_environment_->CreateEventExecutor( 167 event_executor_ = desktop_environment->CreateEventExecutor(
167 input_task_runner_, ui_task_runner_); 168 input_task_runner_, ui_task_runner_);
168 event_executor_->Start(CreateClipboardProxy()); 169 event_executor_->Start(CreateClipboardProxy());
169 170
170 // Connect the host clipboard and input stubs. 171 // Connect the host clipboard and input stubs.
171 host_input_filter_.set_input_stub(event_executor_.get()); 172 host_input_filter_.set_input_stub(event_executor_.get());
172 clipboard_echo_filter_.set_host_stub(event_executor_.get()); 173 clipboard_echo_filter_.set_host_stub(event_executor_.get());
173 174
174 SetDisableInputs(false); 175 SetDisableInputs(false);
175 176
176 // Create a VideoEncoder based on the session's video channel configuration. 177 // Create a VideoEncoder based on the session's video channel configuration.
177 scoped_ptr<VideoEncoder> video_encoder = 178 scoped_ptr<VideoEncoder> video_encoder =
178 CreateVideoEncoder(connection_->session()->config()); 179 CreateVideoEncoder(connection_->session()->config());
179 180
180 // Create a VideoScheduler to pump frames from the capturer to the client. 181 // Create a VideoScheduler to pump frames from the capturer to the client.
181 video_scheduler_ = VideoScheduler::Create( 182 video_scheduler_ = VideoScheduler::Create(
182 video_capture_task_runner_, 183 video_capture_task_runner_,
183 video_encode_task_runner_, 184 video_encode_task_runner_,
184 network_task_runner_, 185 network_task_runner_,
185 desktop_environment_->CreateVideoCapturer(video_capture_task_runner_, 186 desktop_environment->CreateVideoCapturer(video_capture_task_runner_,
186 video_encode_task_runner_), 187 video_encode_task_runner_),
187 video_encoder.Pass(), 188 video_encoder.Pass(),
188 connection_->client_stub(), 189 connection_->client_stub(),
189 &mouse_clamping_filter_); 190 &mouse_clamping_filter_);
190 191
191 // Create an AudioScheduler if audio is enabled, to pump audio samples. 192 // Create an AudioScheduler if audio is enabled, to pump audio samples.
192 if (connection_->session()->config().is_audio_enabled()) { 193 if (connection_->session()->config().is_audio_enabled()) {
193 scoped_ptr<AudioEncoder> audio_encoder = 194 scoped_ptr<AudioEncoder> audio_encoder =
194 CreateAudioEncoder(connection_->session()->config()); 195 CreateAudioEncoder(connection_->session()->config());
195 audio_scheduler_ = AudioScheduler::Create( 196 audio_scheduler_ = AudioScheduler::Create(
196 audio_task_runner_, 197 audio_task_runner_,
197 network_task_runner_, 198 network_task_runner_,
198 desktop_environment_->CreateAudioCapturer(audio_task_runner_), 199 desktop_environment->CreateAudioCapturer(audio_task_runner_),
199 audio_encoder.Pass(), 200 audio_encoder.Pass(),
200 connection_->audio_stub()); 201 connection_->audio_stub());
201 } 202 }
202 203
203 // Notify the event handler that all our channels are now connected. 204 // Notify the event handler that all our channels are now connected.
204 event_handler_->OnSessionChannelsConnected(this); 205 event_handler_->OnSessionChannelsConnected(this);
205 } 206 }
206 207
207 void ClientSession::OnConnectionClosed( 208 void ClientSession::OnConnectionClosed(
208 protocol::ConnectionToClient* connection, 209 protocol::ConnectionToClient* connection,
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 return scoped_ptr<AudioEncoder>(new AudioEncoderSpeex()); 329 return scoped_ptr<AudioEncoder>(new AudioEncoderSpeex());
329 } else if (audio_config.codec == protocol::ChannelConfig::CODEC_OPUS) { 330 } else if (audio_config.codec == protocol::ChannelConfig::CODEC_OPUS) {
330 return scoped_ptr<AudioEncoder>(new AudioEncoderOpus()); 331 return scoped_ptr<AudioEncoder>(new AudioEncoderOpus());
331 } 332 }
332 333
333 NOTIMPLEMENTED(); 334 NOTIMPLEMENTED();
334 return scoped_ptr<AudioEncoder>(NULL); 335 return scoped_ptr<AudioEncoder>(NULL);
335 } 336 }
336 337
337 } // namespace remoting 338 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698