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 #ifndef REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ | 5 #ifndef REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ |
6 #define REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ | 6 #define REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/threading/non_thread_safe.h" | 14 #include "base/threading/non_thread_safe.h" |
15 #include "base/timer/timer.h" | 15 #include "base/timer/timer.h" |
16 #include "remoting/jingle_glue/signal_strategy.h" | 16 #include "remoting/jingle_glue/signal_strategy.h" |
17 #include "remoting/proto/internal.pb.h" | 17 #include "remoting/proto/internal.pb.h" |
18 #include "remoting/protocol/clipboard_filter.h" | 18 #include "remoting/protocol/clipboard_filter.h" |
19 #include "remoting/protocol/errors.h" | 19 #include "remoting/protocol/errors.h" |
20 #include "remoting/protocol/input_filter.h" | 20 #include "remoting/protocol/input_filter.h" |
21 #include "remoting/protocol/message_reader.h" | 21 #include "remoting/protocol/message_reader.h" |
22 #include "remoting/protocol/monitored_video_stub.h" | 22 #include "remoting/protocol/monitored_video_stub.h" |
23 #include "remoting/protocol/session.h" | 23 #include "remoting/protocol/session.h" |
24 #include "remoting/protocol/session_manager.h" | 24 #include "remoting/protocol/session_manager.h" |
25 | 25 |
26 namespace pp { | |
27 class Instance; | |
28 } // namespace pp | |
29 | |
30 namespace remoting { | 26 namespace remoting { |
31 | 27 |
32 class XmppProxy; | 28 class XmppProxy; |
33 class VideoPacket; | 29 class VideoPacket; |
34 | 30 |
35 namespace protocol { | 31 namespace protocol { |
36 | 32 |
37 class AudioReader; | 33 class AudioReader; |
38 class AudioStub; | 34 class AudioStub; |
39 class Authenticator; | 35 class Authenticator; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 virtual void OnConnectionReady(bool ready) = 0; | 76 virtual void OnConnectionReady(bool ready) = 0; |
81 | 77 |
82 // Called when the route type (direct vs. STUN vs. proxied) changes. | 78 // Called when the route type (direct vs. STUN vs. proxied) changes. |
83 virtual void OnRouteChanged(const std::string& channel_name, | 79 virtual void OnRouteChanged(const std::string& channel_name, |
84 const protocol::TransportRoute& route) = 0; | 80 const protocol::TransportRoute& route) = 0; |
85 }; | 81 }; |
86 | 82 |
87 ConnectionToHost(bool allow_nat_traversal); | 83 ConnectionToHost(bool allow_nat_traversal); |
88 virtual ~ConnectionToHost(); | 84 virtual ~ConnectionToHost(); |
89 | 85 |
90 // |signal_strategy| must outlive connection. |audio_stub| may be | 86 // Set the stubs which will handle messages from the host. |
91 // null, in which case audio will not be requested. | 87 // The caller must ensure that stubs out-live the connection. |
| 88 // Unless otherwise specified, all stubs must be set before Connect() |
| 89 // is called. |
| 90 void set_client_stub(ClientStub* client_stub); |
| 91 void set_clipboard_stub(ClipboardStub* clipboard_stub); |
| 92 void set_video_stub(VideoStub* video_stub); |
| 93 // If no audio stub is specified then audio will not be requested. |
| 94 void set_audio_stub(AudioStub* audio_stub); |
| 95 |
| 96 // Initiates a connection to the host specified by |host_jid|. |
| 97 // |signal_strategy| is used to signal to the host, and must outlive the |
| 98 // connection. Data channels will be negotiated over |transport_factory|. |
| 99 // |authenticator| will be used to authenticate the session and data channels. |
| 100 // |event_callback| will be notified of changes in the state of the connection |
| 101 // and must outlive the ConnectionToHost. |
| 102 // Caller must set stubs (see below) before calling Connect. |
92 virtual void Connect(SignalStrategy* signal_strategy, | 103 virtual void Connect(SignalStrategy* signal_strategy, |
| 104 scoped_ptr<TransportFactory> transport_factory, |
| 105 scoped_ptr<Authenticator> authenticator, |
93 const std::string& host_jid, | 106 const std::string& host_jid, |
94 const std::string& host_public_key, | 107 const std::string& host_public_key, |
95 scoped_ptr<TransportFactory> transport_factory, | 108 HostEventCallback* event_callback); |
96 scoped_ptr<Authenticator> authenticator, | |
97 HostEventCallback* event_callback, | |
98 ClientStub* client_stub, | |
99 ClipboardStub* clipboard_stub, | |
100 VideoStub* video_stub, | |
101 AudioStub* audio_stub); | |
102 | 109 |
| 110 // Returns the session configuration that was negotiated with the host. |
103 virtual const SessionConfig& config(); | 111 virtual const SessionConfig& config(); |
104 | 112 |
105 // Stubs for sending data to the host. | 113 // Stubs for sending data to the host. |
106 virtual ClipboardStub* clipboard_stub(); | 114 virtual ClipboardStub* clipboard_forwarder(); |
107 virtual HostStub* host_stub(); | 115 virtual HostStub* host_stub(); |
108 virtual InputStub* input_stub(); | 116 virtual InputStub* input_stub(); |
109 | 117 |
110 // SignalStrategy::StatusObserver interface. | 118 // SignalStrategy::StatusObserver interface. |
111 virtual void OnSignalStrategyStateChange( | 119 virtual void OnSignalStrategyStateChange( |
112 SignalStrategy::State state) OVERRIDE; | 120 SignalStrategy::State state) OVERRIDE; |
113 virtual bool OnSignalStrategyIncomingStanza( | 121 virtual bool OnSignalStrategyIncomingStanza( |
114 const buzz::XmlElement* stanza) OVERRIDE; | 122 const buzz::XmlElement* stanza) OVERRIDE; |
115 | 123 |
116 // SessionManager::Listener interface. | 124 // SessionManager::Listener interface. |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 ErrorCode error_; | 181 ErrorCode error_; |
174 | 182 |
175 private: | 183 private: |
176 DISALLOW_COPY_AND_ASSIGN(ConnectionToHost); | 184 DISALLOW_COPY_AND_ASSIGN(ConnectionToHost); |
177 }; | 185 }; |
178 | 186 |
179 } // namespace protocol | 187 } // namespace protocol |
180 } // namespace remoting | 188 } // namespace remoting |
181 | 189 |
182 #endif // REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ | 190 #endif // REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ |
OLD | NEW |