Chromium Code Reviews| 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 // Initiates a connection to the host specified by |host_jid|. |
| 91 // null, in which case audio will not be requested. | 87 // |signal_strategy| is used to signal to the host, and must outlive the |
| 88 // connection. Data channels will be negotiated over |transport_factory|. | |
| 89 // |authenticator| will be used to authenticate the session and data channels. | |
| 90 // |event_callback| will be notified of changes in the state of the connection | |
| 91 // and must outlive the ConnectionToHost. | |
| 92 // Caller must set stubs (see below) before calling Connect. | |
| 92 virtual void Connect(SignalStrategy* signal_strategy, | 93 virtual void Connect(SignalStrategy* signal_strategy, |
| 94 scoped_ptr<TransportFactory> transport_factory, | |
| 95 scoped_ptr<Authenticator> authenticator, | |
| 93 const std::string& host_jid, | 96 const std::string& host_jid, |
| 94 const std::string& host_public_key, | 97 const std::string& host_public_key, |
| 95 scoped_ptr<TransportFactory> transport_factory, | 98 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 | 99 |
| 100 // Returns the session configuration that was negotiated with the host. | |
| 103 virtual const SessionConfig& config(); | 101 virtual const SessionConfig& config(); |
| 104 | 102 |
| 105 // Stubs for sending data to the host. | 103 // Stubs for sending data to the host. |
| 106 virtual ClipboardStub* clipboard_stub(); | 104 virtual ClipboardStub* clipboard_forwarder(); |
| 107 virtual HostStub* host_stub(); | 105 virtual HostStub* host_stub(); |
| 108 virtual InputStub* input_stub(); | 106 virtual InputStub* input_stub(); |
| 109 | 107 |
| 108 // Set the stubs which will handle messages from the host. | |
|
Sergey Ulanov
2014/05/21 03:42:33
nit: put this above Connect(), because they are no
Wez
2014/05/21 05:14:21
Done.
| |
| 109 // The caller must ensure that stubs out-live the connection. | |
| 110 // Unless otherwise specified, all stubs must be set before Connect() | |
| 111 // is called. | |
| 112 virtual void set_client_stub(ClientStub* client_stub); | |
|
Sergey Ulanov
2014/05/21 03:42:33
Do these need to be virtual?
Can they be inlined?
Wez
2014/05/21 05:14:21
Nope. Fixed.
| |
| 113 virtual void set_clipboard_stub(ClipboardStub* clipboard_stub); | |
| 114 virtual void set_video_stub(VideoStub* video_stub); | |
| 115 // If no audio stub is specified then audio will not be requested. | |
| 116 virtual void set_audio_stub(AudioStub* audio_stub); | |
| 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. |
| 117 virtual void OnSessionManagerReady() OVERRIDE; | 125 virtual void OnSessionManagerReady() OVERRIDE; |
| 118 virtual void OnIncomingSession( | 126 virtual void OnIncomingSession( |
| 119 Session* session, | 127 Session* session, |
| (...skipping 53 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 |