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

Side by Side Diff: remoting/protocol/connection_to_host.cc

Issue 6594138: Block event processing on host/client until the client has authenticated. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix merge conflict Created 9 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/protocol/connection_to_host.h ('k') | remoting/protocol/host_message_dispatcher.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/protocol/connection_to_host.h" 5 #include "remoting/protocol/connection_to_host.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "remoting/base/constants.h" 9 #include "remoting/base/constants.h"
10 #include "remoting/jingle_glue/jingle_thread.h" 10 #include "remoting/jingle_glue/jingle_thread.h"
11 #include "remoting/proto/auth.pb.h" 11 #include "remoting/proto/auth.pb.h"
12 #include "remoting/protocol/client_message_dispatcher.h" 12 #include "remoting/protocol/client_message_dispatcher.h"
13 #include "remoting/protocol/client_stub.h" 13 #include "remoting/protocol/client_stub.h"
14 #include "remoting/protocol/host_control_sender.h" 14 #include "remoting/protocol/host_control_sender.h"
15 #include "remoting/protocol/input_sender.h" 15 #include "remoting/protocol/input_sender.h"
16 #include "remoting/protocol/jingle_session_manager.h" 16 #include "remoting/protocol/jingle_session_manager.h"
17 #include "remoting/protocol/video_reader.h" 17 #include "remoting/protocol/video_reader.h"
18 #include "remoting/protocol/video_stub.h" 18 #include "remoting/protocol/video_stub.h"
19 #include "remoting/protocol/util.h" 19 #include "remoting/protocol/util.h"
20 20
21 namespace remoting { 21 namespace remoting {
22 namespace protocol { 22 namespace protocol {
23 23
24 ConnectionToHost::ConnectionToHost( 24 ConnectionToHost::ConnectionToHost(
25 JingleThread* thread, 25 JingleThread* thread,
26 talk_base::NetworkManager* network_manager, 26 talk_base::NetworkManager* network_manager,
27 talk_base::PacketSocketFactory* socket_factory) 27 talk_base::PacketSocketFactory* socket_factory)
28 : thread_(thread), 28 : client_authenticated_(false),
29 thread_(thread),
29 network_manager_(network_manager), 30 network_manager_(network_manager),
30 socket_factory_(socket_factory), 31 socket_factory_(socket_factory),
31 event_callback_(NULL), 32 event_callback_(NULL),
32 dispatcher_(new ClientMessageDispatcher()) { 33 dispatcher_(new ClientMessageDispatcher()) {
33 } 34 }
34 35
35 ConnectionToHost::~ConnectionToHost() { 36 ConnectionToHost::~ConnectionToHost() {
36 } 37 }
37 38
38 InputStub* ConnectionToHost::input_stub() { 39 InputStub* ConnectionToHost::input_stub() {
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 break; 184 break;
184 185
185 case Session::CLOSED: 186 case Session::CLOSED:
186 event_callback_->OnConnectionClosed(this); 187 event_callback_->OnConnectionClosed(this);
187 break; 188 break;
188 189
189 case Session::CONNECTED: 190 case Session::CONNECTED:
190 // Initialize reader and writer. 191 // Initialize reader and writer.
191 video_reader_.reset(VideoReader::Create(session_->config())); 192 video_reader_.reset(VideoReader::Create(session_->config()));
192 video_reader_->Init(session_, video_stub_); 193 video_reader_->Init(session_, video_stub_);
193 input_stub_.reset(new InputSender(session_->event_channel()));
194 host_stub_.reset(new HostControlSender(session_->control_channel())); 194 host_stub_.reset(new HostControlSender(session_->control_channel()));
195 dispatcher_->Initialize(session_.get(), client_stub_); 195 dispatcher_->Initialize(session_.get(), client_stub_);
196 event_callback_->OnConnectionOpened(this); 196 event_callback_->OnConnectionOpened(this);
197 break; 197 break;
198 198
199 default: 199 default:
200 // Ignore the other states by default. 200 // Ignore the other states by default.
201 break; 201 break;
202 } 202 }
203 } 203 }
204 204
205 void ConnectionToHost::OnClientAuthenticated() {
206 client_authenticated_ = true;
207
208 // Create and enable the input stub now that we're authenticated.
209 input_stub_.reset(new InputSender(session_->event_channel()));
210 input_stub_->OnAuthenticated();
211
212 // Enable control channel stubs.
213 if (host_stub_.get())
214 host_stub_->OnAuthenticated();
215 if (client_stub_)
216 client_stub_->OnAuthenticated();
217 }
218
205 } // namespace protocol 219 } // namespace protocol
206 } // namespace remoting 220 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/connection_to_host.h ('k') | remoting/protocol/host_message_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698