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

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

Issue 6711033: A new authenticated connection evicts an old one. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync. 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) 2011 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_client.h" 5 #include "remoting/protocol/connection_to_client.h"
6 6
7 #include "google/protobuf/message.h" 7 #include "google/protobuf/message.h"
8 #include "net/base/io_buffer.h" 8 #include "net/base/io_buffer.h"
9 #include "remoting/protocol/client_control_sender.h" 9 #include "remoting/protocol/client_control_sender.h"
10 #include "remoting/protocol/host_message_dispatcher.h" 10 #include "remoting/protocol/host_message_dispatcher.h"
11 #include "remoting/protocol/host_stub.h" 11 #include "remoting/protocol/host_stub.h"
12 #include "remoting/protocol/input_stub.h" 12 #include "remoting/protocol/input_stub.h"
13 13
14 // TODO(hclam): Remove this header once MessageDispatcher is used. 14 // TODO(hclam): Remove this header once MessageDispatcher is used.
15 #include "remoting/base/compound_buffer.h" 15 #include "remoting/base/compound_buffer.h"
16 16
17 namespace remoting { 17 namespace remoting {
18 namespace protocol { 18 namespace protocol {
19 19
20 // Determine how many update streams we should count to find the size of 20 // Determine how many update streams we should count to find the size of
21 // average update stream. 21 // average update stream.
22 static const size_t kAverageUpdateStream = 10; 22 static const size_t kAverageUpdateStream = 10;
23 23
24 ConnectionToClient::ConnectionToClient(MessageLoop* message_loop, 24 ConnectionToClient::ConnectionToClient(MessageLoop* message_loop,
25 EventHandler* handler, 25 EventHandler* handler,
26 HostStub* host_stub,
27 InputStub* input_stub) 26 InputStub* input_stub)
28 : client_authenticated_(false), 27 : client_authenticated_(false),
29 loop_(message_loop), 28 loop_(message_loop),
30 handler_(handler), 29 handler_(handler),
31 host_stub_(host_stub), 30 host_stub_(NULL),
32 input_stub_(input_stub) { 31 input_stub_(input_stub) {
33 DCHECK(loop_); 32 DCHECK(loop_);
34 DCHECK(handler_); 33 DCHECK(handler_);
35 } 34 }
36 35
37 ConnectionToClient::~ConnectionToClient() { 36 ConnectionToClient::~ConnectionToClient() {
38 // TODO(hclam): When we shut down the viewer we may have to close the 37 // TODO(hclam): When we shut down the viewer we may have to close the
39 // connection. 38 // connection.
40 } 39 }
41 40
(...skipping 27 matching lines...) Expand all
69 68
70 VideoStub* ConnectionToClient::video_stub() { 69 VideoStub* ConnectionToClient::video_stub() {
71 return video_writer_.get(); 70 return video_writer_.get();
72 } 71 }
73 72
74 // Return pointer to ClientStub. 73 // Return pointer to ClientStub.
75 ClientStub* ConnectionToClient::client_stub() { 74 ClientStub* ConnectionToClient::client_stub() {
76 return client_stub_.get(); 75 return client_stub_.get();
77 } 76 }
78 77
78 protocol::HostStub* ConnectionToClient::host_stub() {
79 return host_stub_;
80 }
81
82 void ConnectionToClient::set_host_stub(protocol::HostStub* host_stub) {
83 host_stub_ = host_stub;
84 }
85
79 void ConnectionToClient::OnSessionStateChange(protocol::Session::State state) { 86 void ConnectionToClient::OnSessionStateChange(protocol::Session::State state) {
80 if (state == protocol::Session::CONNECTED) { 87 if (state == protocol::Session::CONNECTED) {
81 client_stub_.reset(new ClientControlSender(session_->control_channel())); 88 client_stub_.reset(new ClientControlSender(session_->control_channel()));
82 video_writer_.reset(VideoWriter::Create(session_->config())); 89 video_writer_.reset(VideoWriter::Create(session_->config()));
83 video_writer_->Init(session_); 90 video_writer_->Init(session_);
84 91
85 dispatcher_.reset(new HostMessageDispatcher()); 92 dispatcher_.reset(new HostMessageDispatcher());
86 dispatcher_->Initialize(session_.get(), host_stub_, input_stub_); 93 dispatcher_->Initialize(session_.get(), host_stub_, input_stub_);
87 } 94 }
88 95
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 145
139 // Enable/disable each of the channels. 146 // Enable/disable each of the channels.
140 if (input_stub_) 147 if (input_stub_)
141 input_stub_->OnAuthenticated(); 148 input_stub_->OnAuthenticated();
142 if (host_stub_) 149 if (host_stub_)
143 host_stub_->OnAuthenticated(); 150 host_stub_->OnAuthenticated();
144 if (client_stub_.get()) 151 if (client_stub_.get())
145 client_stub_->OnAuthenticated(); 152 client_stub_->OnAuthenticated();
146 } 153 }
147 154
155 bool ConnectionToClient::client_authenticated() {
156 return client_authenticated_;
157 }
158
148 } // namespace protocol 159 } // namespace protocol
149 } // namespace remoting 160 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/connection_to_client.h ('k') | remoting/protocol/connection_to_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698