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

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

Issue 1520323007: Simplify ConnectionToHost interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sm_cleanup
Patch Set: Created 5 years 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
« no previous file with comments | « remoting/client/client_user_interface.h ('k') | remoting/protocol/connection_to_host_impl.h » ('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 #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 <string> 8 #include <string>
9 9
10 #include "base/callback_forward.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
13 #include "remoting/protocol/errors.h" 11 #include "remoting/protocol/errors.h"
14 12
15 namespace remoting { 13 namespace remoting {
16
17 class SignalStrategy;
18
19 namespace protocol { 14 namespace protocol {
20 15
21 class AudioStub; 16 class AudioStub;
22 class Authenticator; 17 class Authenticator;
23 class CandidateSessionConfig;
24 class ClientStub; 18 class ClientStub;
25 class ClipboardStub; 19 class ClipboardStub;
26 class ExtensionMessage;
27 class HostStub; 20 class HostStub;
28 class InputStub; 21 class InputStub;
22 class Session;
29 class SessionConfig; 23 class SessionConfig;
30 class TransportContext;
31 struct TransportRoute; 24 struct TransportRoute;
32 class VideoStub; 25 class VideoStub;
33 26
34 class ConnectionToHost { 27 class ConnectionToHost {
35 public: 28 public:
36 // The UI implementations maintain corresponding definitions of this 29 // The UI implementations maintain corresponding definitions of this
37 // enumeration in client_session.js and 30 // enumeration in client_session.js and
38 // android/java/src/org/chromium/chromoting/jni/JniInterface.java. Be sure to 31 // android/java/src/org/chromium/chromoting/jni/JniInterface.java. Be sure to
39 // update these locations if you make any changes to the ordering. 32 // update these locations if you make any changes to the ordering.
40 enum State { 33 enum State {
(...skipping 21 matching lines...) Expand all
62 // temporarily broken. 55 // temporarily broken.
63 virtual void OnConnectionReady(bool ready) = 0; 56 virtual void OnConnectionReady(bool ready) = 0;
64 57
65 // Called when the route type (direct vs. STUN vs. proxied) changes. 58 // Called when the route type (direct vs. STUN vs. proxied) changes.
66 virtual void OnRouteChanged(const std::string& channel_name, 59 virtual void OnRouteChanged(const std::string& channel_name,
67 const protocol::TransportRoute& route) = 0; 60 const protocol::TransportRoute& route) = 0;
68 }; 61 };
69 62
70 virtual ~ConnectionToHost() {} 63 virtual ~ConnectionToHost() {}
71 64
72 // Allows to set a custom protocol configuration (e.g. for tests). Cannot be
73 // called after Connect().
74 virtual void set_candidate_config(
75 scoped_ptr<CandidateSessionConfig> config) = 0;
76
77 // Set the stubs which will handle messages from the host. 65 // Set the stubs which will handle messages from the host.
78 // The caller must ensure that stubs out-live the connection. 66 // The caller must ensure that stubs out-live the connection.
79 // Unless otherwise specified, all stubs must be set before Connect() 67 // Unless otherwise specified, all stubs must be set before Connect()
80 // is called. 68 // is called.
81 virtual void set_client_stub(ClientStub* client_stub) = 0; 69 virtual void set_client_stub(ClientStub* client_stub) = 0;
82 virtual void set_clipboard_stub(ClipboardStub* clipboard_stub) = 0; 70 virtual void set_clipboard_stub(ClipboardStub* clipboard_stub) = 0;
83 virtual void set_video_stub(VideoStub* video_stub) = 0; 71 virtual void set_video_stub(VideoStub* video_stub) = 0;
84 // If no audio stub is specified then audio will not be requested. 72 // If no audio stub is specified then audio will not be requested.
85 virtual void set_audio_stub(AudioStub* audio_stub) = 0; 73 virtual void set_audio_stub(AudioStub* audio_stub) = 0;
86 74
87 // Initiates a connection to the host specified by |host_jid|. 75 // Initiates a connection using |session|. |event_callback| will be notified
88 // |signal_strategy| is used to signal to the host, and must outlive the 76 // of changes in the state of the connection and must outlive the
89 // connection. Data channels will be negotiated over |transport_factory|. 77 // ConnectionToHost. Caller must set stubs (see below) before calling Connect.
90 // |authenticator| will be used to authenticate the session and data channels. 78 virtual void Connect(scoped_ptr<Session> session,
91 // |event_callback| will be notified of changes in the state of the connection
92 // and must outlive the ConnectionToHost.
93 // Caller must set stubs (see below) before calling Connect.
94 virtual void Connect(SignalStrategy* signal_strategy,
95 scoped_refptr<TransportContext> transport_context,
96 scoped_ptr<Authenticator> authenticator,
97 const std::string& host_jid,
98 HostEventCallback* event_callback) = 0; 79 HostEventCallback* event_callback) = 0;
99 80
100 // Returns the session configuration that was negotiated with the host. 81 // Returns the session configuration that was negotiated with the host.
101 virtual const SessionConfig& config() = 0; 82 virtual const SessionConfig& config() = 0;
102 83
103 // Stubs for sending data to the host. 84 // Stubs for sending data to the host.
104 virtual ClipboardStub* clipboard_forwarder() = 0; 85 virtual ClipboardStub* clipboard_forwarder() = 0;
105 virtual HostStub* host_stub() = 0; 86 virtual HostStub* host_stub() = 0;
106 virtual InputStub* input_stub() = 0; 87 virtual InputStub* input_stub() = 0;
107 88
108 // Return the current state of ConnectionToHost. 89 // Return the current state of ConnectionToHost.
109 virtual State state() const = 0; 90 virtual State state() const = 0;
110 }; 91 };
111 92
112 } // namespace protocol 93 } // namespace protocol
113 } // namespace remoting 94 } // namespace remoting
114 95
115 #endif // REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ 96 #endif // REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_
OLDNEW
« no previous file with comments | « remoting/client/client_user_interface.h ('k') | remoting/protocol/connection_to_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698