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

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

Issue 6623048: Replace libjingle's HttpPortAllocatorSession with Pepper's http client (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: thread switching 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/http_port_allocator.h"
10 #include "remoting/jingle_glue/jingle_thread.h" 11 #include "remoting/jingle_glue/jingle_thread.h"
11 #include "remoting/proto/auth.pb.h" 12 #include "remoting/proto/auth.pb.h"
12 #include "remoting/protocol/client_message_dispatcher.h" 13 #include "remoting/protocol/client_message_dispatcher.h"
13 #include "remoting/protocol/client_stub.h" 14 #include "remoting/protocol/client_stub.h"
14 #include "remoting/protocol/host_control_sender.h" 15 #include "remoting/protocol/host_control_sender.h"
15 #include "remoting/protocol/input_sender.h" 16 #include "remoting/protocol/input_sender.h"
16 #include "remoting/protocol/jingle_session_manager.h" 17 #include "remoting/protocol/jingle_session_manager.h"
17 #include "remoting/protocol/video_reader.h" 18 #include "remoting/protocol/video_reader.h"
18 #include "remoting/protocol/video_stub.h" 19 #include "remoting/protocol/video_stub.h"
19 #include "remoting/protocol/util.h" 20 #include "remoting/protocol/util.h"
20 21
21 namespace remoting { 22 namespace remoting {
22 namespace protocol { 23 namespace protocol {
23 24
24 ConnectionToHost::ConnectionToHost( 25 ConnectionToHost::ConnectionToHost(
25 JingleThread* thread, 26 JingleThread* thread,
26 talk_base::NetworkManager* network_manager, 27 talk_base::NetworkManager* network_manager,
27 talk_base::PacketSocketFactory* socket_factory) 28 talk_base::PacketSocketFactory* socket_factory,
29 PortAllocatorSessionFactory* session_factory)
28 : client_authenticated_(false), 30 : client_authenticated_(false),
29 thread_(thread), 31 thread_(thread),
30 network_manager_(network_manager), 32 network_manager_(network_manager),
31 socket_factory_(socket_factory), 33 socket_factory_(socket_factory),
34 port_allocator_session_factory_(session_factory),
32 event_callback_(NULL), 35 event_callback_(NULL),
33 dispatcher_(new ClientMessageDispatcher()) { 36 dispatcher_(new ClientMessageDispatcher()) {
34 } 37 }
35 38
36 ConnectionToHost::~ConnectionToHost() { 39 ConnectionToHost::~ConnectionToHost() {
37 } 40 }
38 41
39 InputStub* ConnectionToHost::input_stub() { 42 InputStub* ConnectionToHost::input_stub() {
40 return input_stub_.get(); 43 return input_stub_.get();
41 } 44 }
(...skipping 18 matching lines...) Expand all
60 63
61 // Initialize |jingle_client_|. 64 // Initialize |jingle_client_|.
62 if (1 == 0) { 65 if (1 == 0) {
63 signal_strategy_.reset(new JavascriptSignalStrategy()); 66 signal_strategy_.reset(new JavascriptSignalStrategy());
64 } else { 67 } else {
65 signal_strategy_.reset( 68 signal_strategy_.reset(
66 new XmppSignalStrategy(thread_, username, auth_token, 69 new XmppSignalStrategy(thread_, username, auth_token,
67 kChromotingTokenServiceName)); 70 kChromotingTokenServiceName));
68 } 71 }
69 72
70 jingle_client_ = new JingleClient(thread_, signal_strategy_.get(), 73 jingle_client_ = new JingleClient(
71 network_manager_.release(), 74 thread_, signal_strategy_.get(), network_manager_.release(),
72 socket_factory_.release(), this); 75 socket_factory_.release(), port_allocator_session_factory_.release(),
76 this);
73 jingle_client_->Init(); 77 jingle_client_->Init();
74 78
75 // Save jid of the host. The actual connection is created later after 79 // Save jid of the host. The actual connection is created later after
76 // |jingle_client_| is connected. 80 // |jingle_client_| is connected.
77 host_jid_ = host_jid; 81 host_jid_ = host_jid;
78 } 82 }
79 83
80 void ConnectionToHost::Disconnect() { 84 void ConnectionToHost::Disconnect() {
81 if (MessageLoop::current() != message_loop()) { 85 if (MessageLoop::current() != message_loop()) {
82 message_loop()->PostTask( 86 message_loop()->PostTask(
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 215
212 // Enable control channel stubs. 216 // Enable control channel stubs.
213 if (host_stub_.get()) 217 if (host_stub_.get())
214 host_stub_->OnAuthenticated(); 218 host_stub_->OnAuthenticated();
215 if (client_stub_) 219 if (client_stub_)
216 client_stub_->OnAuthenticated(); 220 client_stub_->OnAuthenticated();
217 } 221 }
218 222
219 } // namespace protocol 223 } // namespace protocol
220 } // namespace remoting 224 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698