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

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

Issue 10284008: Switch client to Pepper UDP API instead of Transport API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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/webapp/manifest.json » ('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) 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/protocol/connection_to_host.h" 5 #include "remoting/protocol/connection_to_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/message_loop_proxy.h" 10 #include "base/message_loop_proxy.h"
(...skipping 11 matching lines...) Expand all
22 #include "remoting/protocol/pepper_transport_factory.h" 22 #include "remoting/protocol/pepper_transport_factory.h"
23 #include "remoting/protocol/video_reader.h" 23 #include "remoting/protocol/video_reader.h"
24 #include "remoting/protocol/video_stub.h" 24 #include "remoting/protocol/video_stub.h"
25 #include "remoting/protocol/util.h" 25 #include "remoting/protocol/util.h"
26 26
27 namespace remoting { 27 namespace remoting {
28 namespace protocol { 28 namespace protocol {
29 29
30 ConnectionToHost::ConnectionToHost( 30 ConnectionToHost::ConnectionToHost(
31 base::MessageLoopProxy* message_loop, 31 base::MessageLoopProxy* message_loop,
32 pp::Instance* pp_instance, 32 pp::Instance* pp_instance,
Wez 2012/05/02 22:32:33 Remove this parameter?
Sergey Ulanov 2012/05/11 19:39:36 Done.
33 bool allow_nat_traversal) 33 bool allow_nat_traversal)
34 : message_loop_(message_loop), 34 : message_loop_(message_loop),
35 pp_instance_(pp_instance),
Wez 2012/05/02 22:32:33 Ouch; isn't ConnectionToHost too generic to have P
Sergey Ulanov 2012/05/11 19:39:36 Maybe. We had some other pepper-specific code in /
36 allow_nat_traversal_(allow_nat_traversal), 35 allow_nat_traversal_(allow_nat_traversal),
37 event_callback_(NULL), 36 event_callback_(NULL),
38 client_stub_(NULL), 37 client_stub_(NULL),
39 clipboard_stub_(NULL), 38 clipboard_stub_(NULL),
40 video_stub_(NULL), 39 video_stub_(NULL),
41 state_(CONNECTING), 40 state_(CONNECTING),
42 error_(OK) { 41 error_(OK) {
43 } 42 }
44 43
45 ConnectionToHost::~ConnectionToHost() { 44 ConnectionToHost::~ConnectionToHost() {
46 } 45 }
47 46
48 ClipboardStub* ConnectionToHost::clipboard_stub() { 47 ClipboardStub* ConnectionToHost::clipboard_stub() {
49 return &clipboard_forwarder_; 48 return &clipboard_forwarder_;
50 } 49 }
51 50
52 HostStub* ConnectionToHost::host_stub() { 51 HostStub* ConnectionToHost::host_stub() {
53 // TODO(wez): Add a HostFilter class, equivalent to input filter. 52 // TODO(wez): Add a HostFilter class, equivalent to input filter.
54 return control_dispatcher_.get(); 53 return control_dispatcher_.get();
55 } 54 }
56 55
57 InputStub* ConnectionToHost::input_stub() { 56 InputStub* ConnectionToHost::input_stub() {
58 return &event_forwarder_; 57 return &event_forwarder_;
59 } 58 }
60 59
61 void ConnectionToHost::Connect(scoped_refptr<XmppProxy> xmpp_proxy, 60 void ConnectionToHost::Connect(scoped_refptr<XmppProxy> xmpp_proxy,
62 const std::string& local_jid, 61 const std::string& local_jid,
63 const std::string& host_jid, 62 const std::string& host_jid,
64 const std::string& host_public_key, 63 const std::string& host_public_key,
64 scoped_ptr<TransportFactory> transport_factory,
65 scoped_ptr<Authenticator> authenticator, 65 scoped_ptr<Authenticator> authenticator,
66 HostEventCallback* event_callback, 66 HostEventCallback* event_callback,
67 ClientStub* client_stub, 67 ClientStub* client_stub,
68 ClipboardStub* clipboard_stub, 68 ClipboardStub* clipboard_stub,
69 VideoStub* video_stub) { 69 VideoStub* video_stub) {
70 event_callback_ = event_callback; 70 event_callback_ = event_callback;
71 client_stub_ = client_stub; 71 client_stub_ = client_stub;
72 clipboard_stub_ = clipboard_stub; 72 clipboard_stub_ = clipboard_stub;
73 video_stub_ = video_stub; 73 video_stub_ = video_stub;
74 authenticator_ = authenticator.Pass(); 74 authenticator_ = authenticator.Pass();
75 75
76 // Save jid of the host. The actual connection is created later after 76 // Save jid of the host. The actual connection is created later after
77 // |signal_strategy_| is connected. 77 // |signal_strategy_| is connected.
78 host_jid_ = host_jid; 78 host_jid_ = host_jid;
79 host_public_key_ = host_public_key; 79 host_public_key_ = host_public_key;
80 80
81 JavascriptSignalStrategy* strategy = new JavascriptSignalStrategy(local_jid); 81 JavascriptSignalStrategy* strategy = new JavascriptSignalStrategy(local_jid);
82 strategy->AttachXmppProxy(xmpp_proxy); 82 strategy->AttachXmppProxy(xmpp_proxy);
83 signal_strategy_.reset(strategy); 83 signal_strategy_.reset(strategy);
84 signal_strategy_->AddListener(this); 84 signal_strategy_->AddListener(this);
85 signal_strategy_->Connect(); 85 signal_strategy_->Connect();
86 86
87 scoped_ptr<TransportFactory> transport_factory(
88 new PepperTransportFactory(pp_instance_));
89 session_manager_.reset(new JingleSessionManager( 87 session_manager_.reset(new JingleSessionManager(
90 transport_factory.Pass(), true)); 88 transport_factory.Pass(), allow_nat_traversal_));
91 session_manager_->Init(signal_strategy_.get(), this); 89 session_manager_->Init(signal_strategy_.get(), this);
92 } 90 }
93 91
94 void ConnectionToHost::Disconnect(const base::Closure& shutdown_task) { 92 void ConnectionToHost::Disconnect(const base::Closure& shutdown_task) {
95 if (!message_loop_->BelongsToCurrentThread()) { 93 if (!message_loop_->BelongsToCurrentThread()) {
96 message_loop_->PostTask( 94 message_loop_->PostTask(
97 FROM_HERE, base::Bind(&ConnectionToHost::Disconnect, 95 FROM_HERE, base::Bind(&ConnectionToHost::Disconnect,
98 base::Unretained(this), shutdown_task)); 96 base::Unretained(this), shutdown_task));
99 return; 97 return;
100 } 98 }
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 249
252 if (state != state_) { 250 if (state != state_) {
253 state_ = state; 251 state_ = state;
254 error_ = error; 252 error_ = error;
255 event_callback_->OnConnectionState(state_, error_); 253 event_callback_->OnConnectionState(state_, error_);
256 } 254 }
257 } 255 }
258 256
259 } // namespace protocol 257 } // namespace protocol
260 } // namespace remoting 258 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/connection_to_host.h ('k') | remoting/webapp/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698