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

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

Issue 1177983009: Move remoting-specific adapters from jingle/glue to remoting/protocol (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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
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/libjingle_transport_factory.h" 5 #include "remoting/protocol/libjingle_transport_factory.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
11 #include "base/single_thread_task_runner.h" 11 #include "base/single_thread_task_runner.h"
12 #include "base/thread_task_runner_handle.h" 12 #include "base/thread_task_runner_handle.h"
13 #include "base/timer/timer.h" 13 #include "base/timer/timer.h"
14 #include "jingle/glue/channel_socket_adapter.h"
15 #include "jingle/glue/utils.h" 14 #include "jingle/glue/utils.h"
16 #include "net/base/net_errors.h" 15 #include "net/base/net_errors.h"
16 #include "remoting/protocol/channel_socket_adapter.h"
17 #include "remoting/protocol/network_settings.h" 17 #include "remoting/protocol/network_settings.h"
18 #include "remoting/signaling/jingle_info_request.h" 18 #include "remoting/signaling/jingle_info_request.h"
19 #include "third_party/webrtc/base/network.h" 19 #include "third_party/webrtc/base/network.h"
20 #include "third_party/webrtc/p2p/base/constants.h" 20 #include "third_party/webrtc/p2p/base/constants.h"
21 #include "third_party/webrtc/p2p/base/p2ptransportchannel.h" 21 #include "third_party/webrtc/p2p/base/p2ptransportchannel.h"
22 #include "third_party/webrtc/p2p/base/port.h" 22 #include "third_party/webrtc/p2p/base/port.h"
23 #include "third_party/webrtc/p2p/client/basicportallocator.h" 23 #include "third_party/webrtc/p2p/client/basicportallocator.h"
24 #include "third_party/webrtc/p2p/client/httpportallocator.h" 24 #include "third_party/webrtc/p2p/client/httpportallocator.h"
25 25
26 namespace remoting { 26 namespace remoting {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 void NotifyConnected(); 80 void NotifyConnected();
81 81
82 // Signal handlers for cricket::TransportChannel. 82 // Signal handlers for cricket::TransportChannel.
83 void OnRequestSignaling(cricket::TransportChannelImpl* channel); 83 void OnRequestSignaling(cricket::TransportChannelImpl* channel);
84 void OnCandidateReady(cricket::TransportChannelImpl* channel, 84 void OnCandidateReady(cricket::TransportChannelImpl* channel,
85 const cricket::Candidate& candidate); 85 const cricket::Candidate& candidate);
86 void OnRouteChange(cricket::TransportChannel* channel, 86 void OnRouteChange(cricket::TransportChannel* channel,
87 const cricket::Candidate& candidate); 87 const cricket::Candidate& candidate);
88 void OnWritableState(cricket::TransportChannel* channel); 88 void OnWritableState(cricket::TransportChannel* channel);
89 89
90 // Callback for jingle_glue::TransportChannelSocketAdapter to notify when the 90 // Callback for TransportChannelSocketAdapter to notify when the socket is
91 // socket is destroyed. 91 // destroyed.
92 void OnChannelDestroyed(); 92 void OnChannelDestroyed();
93 93
94 void NotifyRouteChanged(); 94 void NotifyRouteChanged();
95 95
96 // Tries to connect by restarting ICE. Called by |reconnect_timer_|. 96 // Tries to connect by restarting ICE. Called by |reconnect_timer_|.
97 void TryReconnect(); 97 void TryReconnect();
98 98
99 cricket::PortAllocator* port_allocator_; 99 cricket::PortAllocator* port_allocator_;
100 NetworkSettings network_settings_; 100 NetworkSettings network_settings_;
101 TransportRole role_; 101 TransportRole role_;
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 FROM_HERE, base::TimeDelta::FromSeconds(kReconnectDelaySeconds), 230 FROM_HERE, base::TimeDelta::FromSeconds(kReconnectDelaySeconds),
231 this, &LibjingleTransport::TryReconnect); 231 this, &LibjingleTransport::TryReconnect);
232 232
233 base::ThreadTaskRunnerHandle::Get()->PostTask( 233 base::ThreadTaskRunnerHandle::Get()->PostTask(
234 FROM_HERE, base::Bind(&LibjingleTransport::NotifyConnected, 234 FROM_HERE, base::Bind(&LibjingleTransport::NotifyConnected,
235 weak_factory_.GetWeakPtr())); 235 weak_factory_.GetWeakPtr()));
236 } 236 }
237 237
238 void LibjingleTransport::NotifyConnected() { 238 void LibjingleTransport::NotifyConnected() {
239 // Create net::Socket adapter for the P2PTransportChannel. 239 // Create net::Socket adapter for the P2PTransportChannel.
240 scoped_ptr<jingle_glue::TransportChannelSocketAdapter> socket( 240 scoped_ptr<TransportChannelSocketAdapter> socket(
241 new jingle_glue::TransportChannelSocketAdapter(channel_.get())); 241 new TransportChannelSocketAdapter(channel_.get()));
242 socket->SetOnDestroyedCallback(base::Bind( 242 socket->SetOnDestroyedCallback(base::Bind(
243 &LibjingleTransport::OnChannelDestroyed, base::Unretained(this))); 243 &LibjingleTransport::OnChannelDestroyed, base::Unretained(this)));
244 base::ResetAndReturn(&callback_).Run(socket.Pass()); 244 base::ResetAndReturn(&callback_).Run(socket.Pass());
245 } 245 }
246 246
247 void LibjingleTransport::SetRemoteCredentials(const std::string& ufrag, 247 void LibjingleTransport::SetRemoteCredentials(const std::string& ufrag,
248 const std::string& password) { 248 const std::string& password) {
249 DCHECK(CalledOnValidThread()); 249 DCHECK(CalledOnValidThread());
250 250
251 remote_ice_username_fragment_ = ufrag; 251 remote_ice_username_fragment_ = ufrag;
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 last_jingle_info_update_time_ = base::TimeTicks::Now(); 467 last_jingle_info_update_time_ = base::TimeTicks::Now();
468 468
469 while (!on_jingle_info_callbacks_.empty()) { 469 while (!on_jingle_info_callbacks_.empty()) {
470 on_jingle_info_callbacks_.begin()->Run(); 470 on_jingle_info_callbacks_.begin()->Run();
471 on_jingle_info_callbacks_.pop_front(); 471 on_jingle_info_callbacks_.pop_front();
472 } 472 }
473 } 473 }
474 474
475 } // namespace protocol 475 } // namespace protocol
476 } // namespace remoting 476 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/channel_socket_adapter_unittest.cc ('k') | remoting/protocol/pseudotcp_adapter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698