OLD | NEW |
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 "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
9 #include "base/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
10 #include "base/timer/timer.h" | 10 #include "base/timer/timer.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 // Get fresh STUN/Relay configuration every hour. | 32 // Get fresh STUN/Relay configuration every hour. |
33 const int kJingleInfoUpdatePeriodSeconds = 3600; | 33 const int kJingleInfoUpdatePeriodSeconds = 3600; |
34 | 34 |
35 class LibjingleTransport | 35 class LibjingleTransport |
36 : public Transport, | 36 : public Transport, |
37 public base::SupportsWeakPtr<LibjingleTransport>, | 37 public base::SupportsWeakPtr<LibjingleTransport>, |
38 public sigslot::has_slots<> { | 38 public sigslot::has_slots<> { |
39 public: | 39 public: |
40 LibjingleTransport(cricket::PortAllocator* port_allocator, | 40 LibjingleTransport(cricket::PortAllocator* port_allocator, |
41 const NetworkSettings& network_settings); | 41 const NetworkSettings& network_settings); |
42 virtual ~LibjingleTransport(); | 42 ~LibjingleTransport() override; |
43 | 43 |
44 // Called by JingleTransportFactory when it has fresh Jingle info. | 44 // Called by JingleTransportFactory when it has fresh Jingle info. |
45 void OnCanStart(); | 45 void OnCanStart(); |
46 | 46 |
47 // Transport interface. | 47 // Transport interface. |
48 virtual void Connect( | 48 void Connect(const std::string& name, |
49 const std::string& name, | 49 Transport::EventHandler* event_handler, |
50 Transport::EventHandler* event_handler, | 50 const Transport::ConnectedCallback& callback) override; |
51 const Transport::ConnectedCallback& callback) override; | 51 void AddRemoteCandidate(const cricket::Candidate& candidate) override; |
52 virtual void AddRemoteCandidate(const cricket::Candidate& candidate) override; | 52 const std::string& name() const override; |
53 virtual const std::string& name() const override; | 53 bool is_connected() const override; |
54 virtual bool is_connected() const override; | |
55 | 54 |
56 private: | 55 private: |
57 void DoStart(); | 56 void DoStart(); |
58 void NotifyConnected(); | 57 void NotifyConnected(); |
59 | 58 |
60 // Signal handlers for cricket::TransportChannel. | 59 // Signal handlers for cricket::TransportChannel. |
61 void OnRequestSignaling(cricket::TransportChannelImpl* channel); | 60 void OnRequestSignaling(cricket::TransportChannelImpl* channel); |
62 void OnCandidateReady(cricket::TransportChannelImpl* channel, | 61 void OnCandidateReady(cricket::TransportChannelImpl* channel, |
63 const cricket::Candidate& candidate); | 62 const cricket::Candidate& candidate); |
64 void OnRouteChange(cricket::TransportChannel* channel, | 63 void OnRouteChange(cricket::TransportChannel* channel, |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 last_jingle_info_update_time_ = base::TimeTicks::Now(); | 388 last_jingle_info_update_time_ = base::TimeTicks::Now(); |
390 | 389 |
391 while (!on_jingle_info_callbacks_.empty()) { | 390 while (!on_jingle_info_callbacks_.empty()) { |
392 on_jingle_info_callbacks_.begin()->Run(); | 391 on_jingle_info_callbacks_.begin()->Run(); |
393 on_jingle_info_callbacks_.pop_front(); | 392 on_jingle_info_callbacks_.pop_front(); |
394 } | 393 } |
395 } | 394 } |
396 | 395 |
397 } // namespace protocol | 396 } // namespace protocol |
398 } // namespace remoting | 397 } // namespace remoting |
OLD | NEW |