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

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: add missing source files 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
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(JingleThread* thread) 24 ConnectionToHost::ConnectionToHost(JingleThread* thread)
25 : thread_(thread), 25 : client_authenticated_(false),
26 thread_(thread),
26 event_callback_(NULL), 27 event_callback_(NULL),
27 dispatcher_(new ClientMessageDispatcher()) { 28 dispatcher_(new ClientMessageDispatcher()) {
28 } 29 }
29 30
30 ConnectionToHost::~ConnectionToHost() { 31 ConnectionToHost::~ConnectionToHost() {
31 } 32 }
32 33
33 InputStub* ConnectionToHost::input_stub() { 34 InputStub* ConnectionToHost::input_stub() {
34 return input_stub_.get(); 35 return input_stub_.get();
35 } 36 }
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 dispatcher_->Initialize(session_.get(), client_stub_); 190 dispatcher_->Initialize(session_.get(), client_stub_);
190 event_callback_->OnConnectionOpened(this); 191 event_callback_->OnConnectionOpened(this);
191 break; 192 break;
192 193
193 default: 194 default:
194 // Ignore the other states by default. 195 // Ignore the other states by default.
195 break; 196 break;
196 } 197 }
197 } 198 }
198 199
200 void ConnectionToHost::SetClientAuthenticated(bool auth) {
201 client_authenticated_ = auth;
202
203 // Enable/disable each of the channels.
204 if (input_stub_.get())
205 input_stub_->SetEnabled(auth);
206 if (host_stub_.get())
207 host_stub_->SetEnabled(auth);
208 if (client_stub_)
209 client_stub_->SetEnabled(auth);
210 }
211
199 } // namespace protocol 212 } // namespace protocol
200 } // namespace remoting 213 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698