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

Side by Side Diff: remoting/client/chromoting_client.h

Issue 976233003: Adding the base ChromotingInstance implementation and unittests. This class will be used by the ap… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing a unit test name Created 5 years, 9 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 // ChromotingClient is the controller for the Client implementation. 5 // ChromotingClient is the controller for the Client implementation.
6 6
7 #ifndef REMOTING_CLIENT_CHROMOTING_CLIENT_H_ 7 #ifndef REMOTING_CLIENT_CHROMOTING_CLIENT_H_
8 #define REMOTING_CLIENT_CHROMOTING_CLIENT_H_ 8 #define REMOTING_CLIENT_CHROMOTING_CLIENT_H_
9 9
10 #include <string> 10 #include <string>
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // |client_context|, |user_interface| and |video_renderer| must outlive the 44 // |client_context|, |user_interface| and |video_renderer| must outlive the
45 // client. |audio_player| may be null, in which case audio will not be 45 // client. |audio_player| may be null, in which case audio will not be
46 // requested. 46 // requested.
47 ChromotingClient(ClientContext* client_context, 47 ChromotingClient(ClientContext* client_context,
48 ClientUserInterface* user_interface, 48 ClientUserInterface* user_interface,
49 VideoRenderer* video_renderer, 49 VideoRenderer* video_renderer,
50 scoped_ptr<AudioPlayer> audio_player); 50 scoped_ptr<AudioPlayer> audio_player);
51 51
52 ~ChromotingClient() override; 52 ~ChromotingClient() override;
53 53
54 // Used to set fake/mock objects for tests which use the ChromotingClient.
54 void SetProtocolConfigForTests( 55 void SetProtocolConfigForTests(
55 scoped_ptr<protocol::CandidateSessionConfig> config); 56 scoped_ptr<protocol::CandidateSessionConfig> config);
57 void SetConnectionToHostForTests(
58 scoped_ptr<protocol::ConnectionToHost> connection_to_host);
56 59
57 // Start the client. Must be called on the main thread. |signal_strategy| 60 // Start the client. Must be called on the main thread. |signal_strategy|
58 // must outlive the client. 61 // must outlive the client.
59 void Start(SignalStrategy* signal_strategy, 62 void Start(SignalStrategy* signal_strategy,
60 scoped_ptr<protocol::Authenticator> authenticator, 63 scoped_ptr<protocol::Authenticator> authenticator,
61 scoped_ptr<protocol::TransportFactory> transport_factory, 64 scoped_ptr<protocol::TransportFactory> transport_factory,
62 const std::string& host_jid, 65 const std::string& host_jid,
63 const std::string& capabilities); 66 const std::string& capabilities);
64 67
65 protocol::ConnectionToHost::State connection_state() const { 68 protocol::ConnectionToHost::State connection_state() const {
66 return connection_.state(); 69 return connection_->state();
67 } 70 }
68 71
69 protocol::ClipboardStub* clipboard_forwarder() { 72 protocol::ClipboardStub* clipboard_forwarder() {
70 return connection_.clipboard_forwarder(); 73 return connection_->clipboard_forwarder();
71 } 74 }
72 protocol::HostStub* host_stub() { return connection_.host_stub(); } 75 protocol::HostStub* host_stub() { return connection_->host_stub(); }
73 protocol::InputStub* input_stub() { return connection_.input_stub(); } 76 protocol::InputStub* input_stub() { return connection_->input_stub(); }
74 77
75 // ClientStub implementation. 78 // ClientStub implementation.
76 void SetCapabilities(const protocol::Capabilities& capabilities) override; 79 void SetCapabilities(const protocol::Capabilities& capabilities) override;
77 void SetPairingResponse( 80 void SetPairingResponse(
78 const protocol::PairingResponse& pairing_response) override; 81 const protocol::PairingResponse& pairing_response) override;
79 void DeliverHostMessage(const protocol::ExtensionMessage& message) override; 82 void DeliverHostMessage(const protocol::ExtensionMessage& message) override;
80 83
81 // ClipboardStub implementation for receiving clipboard data from host. 84 // ClipboardStub implementation for receiving clipboard data from host.
82 void InjectClipboardEvent(const protocol::ClipboardEvent& event) override; 85 void InjectClipboardEvent(const protocol::ClipboardEvent& event) override;
83 86
(...skipping 12 matching lines...) Expand all
96 void OnAuthenticated(); 99 void OnAuthenticated();
97 100
98 // Called when all channels are connected. 101 // Called when all channels are connected.
99 void OnChannelsConnected(); 102 void OnChannelsConnected();
100 103
101 // The following are not owned by this class. 104 // The following are not owned by this class.
102 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 105 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
103 ClientUserInterface* user_interface_; 106 ClientUserInterface* user_interface_;
104 VideoRenderer* video_renderer_; 107 VideoRenderer* video_renderer_;
105 108
106 protocol::ConnectionToHost connection_; 109 scoped_ptr<protocol::ConnectionToHost> connection_;
107 110
108 scoped_ptr<AudioDecodeScheduler> audio_decode_scheduler_; 111 scoped_ptr<AudioDecodeScheduler> audio_decode_scheduler_;
109 112
110 std::string local_capabilities_; 113 std::string local_capabilities_;
111 114
112 // The set of all capabilities supported by the host. 115 // The set of all capabilities supported by the host.
113 std::string host_capabilities_; 116 std::string host_capabilities_;
114 117
115 // True if |protocol::Capabilities| message has been received. 118 // True if |protocol::Capabilities| message has been received.
116 bool host_capabilities_received_; 119 bool host_capabilities_received_;
117 120
118 // Record the statistics of the connection. 121 // Record the statistics of the connection.
119 ChromotingStats stats_; 122 ChromotingStats stats_;
120 123
121 DISALLOW_COPY_AND_ASSIGN(ChromotingClient); 124 DISALLOW_COPY_AND_ASSIGN(ChromotingClient);
122 }; 125 };
123 126
124 } // namespace remoting 127 } // namespace remoting
125 128
126 #endif // REMOTING_CLIENT_CHROMOTING_CLIENT_H_ 129 #endif // REMOTING_CLIENT_CHROMOTING_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698