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_CLIENT_PLUGIN_CHROMOTING_INSTANCE_H_ | 5 #ifndef REMOTING_CLIENT_PLUGIN_CHROMOTING_INSTANCE_H_ |
6 #define REMOTING_CLIENT_PLUGIN_CHROMOTING_INSTANCE_H_ | 6 #define REMOTING_CLIENT_PLUGIN_CHROMOTING_INSTANCE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // Backward-compatibility version used by for the messaging | 95 // Backward-compatibility version used by for the messaging |
96 // interface. Should be updated whenever we remove support for | 96 // interface. Should be updated whenever we remove support for |
97 // an older version of the API. | 97 // an older version of the API. |
98 static const int kApiMinMessagingVersion = 5; | 98 static const int kApiMinMessagingVersion = 5; |
99 | 99 |
100 // Backward-compatibility version used by for the ScriptableObject | 100 // Backward-compatibility version used by for the ScriptableObject |
101 // interface. Should be updated whenever we remove support for | 101 // interface. Should be updated whenever we remove support for |
102 // an older version of the API. | 102 // an older version of the API. |
103 static const int kApiMinScriptableVersion = 5; | 103 static const int kApiMinScriptableVersion = 5; |
104 | 104 |
105 // Helper method to parse authentication_methods parameter. | |
106 static bool ParseAuthMethods(const std::string& auth_methods, | |
107 ClientConfig* config); | |
108 | |
109 explicit ChromotingInstance(PP_Instance instance); | 105 explicit ChromotingInstance(PP_Instance instance); |
110 virtual ~ChromotingInstance(); | 106 virtual ~ChromotingInstance(); |
111 | 107 |
112 // pp::Instance interface. | 108 // pp::Instance interface. |
113 virtual void DidChangeFocus(bool has_focus) OVERRIDE; | 109 virtual void DidChangeFocus(bool has_focus) OVERRIDE; |
114 virtual void DidChangeView(const pp::View& view) OVERRIDE; | 110 virtual void DidChangeView(const pp::View& view) OVERRIDE; |
115 virtual bool Init(uint32_t argc, const char* argn[], | 111 virtual bool Init(uint32_t argc, const char* argn[], |
116 const char* argv[]) OVERRIDE; | 112 const char* argv[]) OVERRIDE; |
117 virtual void HandleMessage(const pp::Var& message) OVERRIDE; | 113 virtual void HandleMessage(const pp::Var& message) OVERRIDE; |
118 virtual bool HandleInputEvent(const pp::InputEvent& event) OVERRIDE; | 114 virtual bool HandleInputEvent(const pp::InputEvent& event) OVERRIDE; |
119 | 115 |
120 // ClientUserInterface interface. | 116 // ClientUserInterface interface. |
121 virtual void OnConnectionState(protocol::ConnectionToHost::State state, | 117 virtual void OnConnectionState(protocol::ConnectionToHost::State state, |
122 protocol::ErrorCode error) OVERRIDE; | 118 protocol::ErrorCode error) OVERRIDE; |
123 virtual void OnConnectionReady(bool ready) OVERRIDE; | 119 virtual void OnConnectionReady(bool ready) OVERRIDE; |
124 virtual void OnRouteChanged(const std::string& channel_name, | 120 virtual void OnRouteChanged(const std::string& channel_name, |
125 const protocol::TransportRoute& route) OVERRIDE; | 121 const protocol::TransportRoute& route) OVERRIDE; |
126 virtual void SetCapabilities(const std::string& capabilities) OVERRIDE; | 122 virtual void SetCapabilities(const std::string& capabilities) OVERRIDE; |
127 virtual void SetPairingResponse( | 123 virtual void SetPairingResponse( |
128 const protocol::PairingResponse& pairing_response) OVERRIDE; | 124 const protocol::PairingResponse& pairing_response) OVERRIDE; |
129 virtual void DeliverHostMessage( | 125 virtual void DeliverHostMessage( |
130 const protocol::ExtensionMessage& message) OVERRIDE; | 126 const protocol::ExtensionMessage& message) OVERRIDE; |
131 virtual protocol::ClipboardStub* GetClipboardStub() OVERRIDE; | 127 virtual protocol::ClipboardStub* GetClipboardStub() OVERRIDE; |
132 virtual protocol::CursorShapeStub* GetCursorShapeStub() OVERRIDE; | 128 virtual protocol::CursorShapeStub* GetCursorShapeStub() OVERRIDE; |
133 virtual scoped_ptr<protocol::ThirdPartyClientAuthenticator::TokenFetcher> | |
134 GetTokenFetcher(const std::string& host_public_key) OVERRIDE; | |
135 | 129 |
136 // protocol::ClipboardStub interface. | 130 // protocol::ClipboardStub interface. |
137 virtual void InjectClipboardEvent( | 131 virtual void InjectClipboardEvent( |
138 const protocol::ClipboardEvent& event) OVERRIDE; | 132 const protocol::ClipboardEvent& event) OVERRIDE; |
139 | 133 |
140 // protocol::CursorShapeStub interface. | 134 // protocol::CursorShapeStub interface. |
141 virtual void SetCursorShape( | 135 virtual void SetCursorShape( |
142 const protocol::CursorShapeInfo& cursor_shape) OVERRIDE; | 136 const protocol::CursorShapeInfo& cursor_shape) OVERRIDE; |
143 | 137 |
144 // Called by PepperView. | 138 // Called by PepperView. |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 void HandlePauseAudio(const base::DictionaryValue& data); | 200 void HandlePauseAudio(const base::DictionaryValue& data); |
207 void HandleOnPinFetched(const base::DictionaryValue& data); | 201 void HandleOnPinFetched(const base::DictionaryValue& data); |
208 void HandleOnThirdPartyTokenFetched(const base::DictionaryValue& data); | 202 void HandleOnThirdPartyTokenFetched(const base::DictionaryValue& data); |
209 void HandleRequestPairing(const base::DictionaryValue& data); | 203 void HandleRequestPairing(const base::DictionaryValue& data); |
210 void HandleExtensionMessage(const base::DictionaryValue& data); | 204 void HandleExtensionMessage(const base::DictionaryValue& data); |
211 void HandleAllowMouseLockMessage(); | 205 void HandleAllowMouseLockMessage(); |
212 void HandleEnableMediaSourceRendering(); | 206 void HandleEnableMediaSourceRendering(); |
213 void HandleSendMouseInputWhenUnfocused(); | 207 void HandleSendMouseInputWhenUnfocused(); |
214 void HandleDelegateLargeCursors(); | 208 void HandleDelegateLargeCursors(); |
215 | 209 |
216 // Helper method called from Connect() to connect with parsed config. | |
217 void ConnectWithConfig(const ClientConfig& config, | |
218 const std::string& local_jid); | |
219 | |
220 // Helper method to post messages to the webapp. | 210 // Helper method to post messages to the webapp. |
221 void PostChromotingMessage(const std::string& method, | 211 void PostChromotingMessage(const std::string& method, |
222 const pp::VarDictionary& data); | 212 const pp::VarDictionary& data); |
223 | 213 |
224 // Same as above, but serializes messages to JSON before sending them. This | 214 // Same as above, but serializes messages to JSON before sending them. This |
225 // method is used for backward compatibility with older version of the webapp | 215 // method is used for backward compatibility with older version of the webapp |
226 // that expect to received most messages formatted using JSON. | 216 // that expect to received most messages formatted using JSON. |
227 // | 217 // |
228 // TODO(sergeyu): When all current versions of the webapp support raw messages | 218 // TODO(sergeyu): When all current versions of the webapp support raw messages |
229 // remove this method and use PostChromotingMessage() instead. | 219 // remove this method and use PostChromotingMessage() instead. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 scoped_ptr<VideoRenderer> video_renderer_; | 260 scoped_ptr<VideoRenderer> video_renderer_; |
271 scoped_ptr<PepperView> view_; | 261 scoped_ptr<PepperView> view_; |
272 scoped_ptr<base::WeakPtrFactory<FrameConsumer> > view_weak_factory_; | 262 scoped_ptr<base::WeakPtrFactory<FrameConsumer> > view_weak_factory_; |
273 pp::View plugin_view_; | 263 pp::View plugin_view_; |
274 | 264 |
275 // Contains the most-recently-reported desktop shape, if any. | 265 // Contains the most-recently-reported desktop shape, if any. |
276 scoped_ptr<webrtc::DesktopRegion> desktop_shape_; | 266 scoped_ptr<webrtc::DesktopRegion> desktop_shape_; |
277 | 267 |
278 scoped_ptr<DelegatingSignalStrategy> signal_strategy_; | 268 scoped_ptr<DelegatingSignalStrategy> signal_strategy_; |
279 | 269 |
280 scoped_ptr<protocol::ConnectionToHost> host_connection_; | |
281 scoped_ptr<ChromotingClient> client_; | 270 scoped_ptr<ChromotingClient> client_; |
282 | 271 |
283 // Input pipeline components, in reverse order of distance from input source. | 272 // Input pipeline components, in reverse order of distance from input source. |
284 protocol::MouseInputFilter mouse_input_filter_; | 273 protocol::MouseInputFilter mouse_input_filter_; |
285 protocol::InputEventTracker input_tracker_; | 274 protocol::InputEventTracker input_tracker_; |
286 KeyEventMapper key_mapper_; | 275 KeyEventMapper key_mapper_; |
287 scoped_ptr<protocol::InputFilter> normalizing_input_filter_; | 276 scoped_ptr<protocol::InputFilter> normalizing_input_filter_; |
288 PepperInputHandler input_handler_; | 277 PepperInputHandler input_handler_; |
289 | 278 |
290 // PIN Fetcher. | 279 // PIN Fetcher. |
(...skipping 13 matching lines...) Expand all Loading... |
304 | 293 |
305 // Weak reference to this instance, used for global logging and task posting. | 294 // Weak reference to this instance, used for global logging and task posting. |
306 base::WeakPtrFactory<ChromotingInstance> weak_factory_; | 295 base::WeakPtrFactory<ChromotingInstance> weak_factory_; |
307 | 296 |
308 DISALLOW_COPY_AND_ASSIGN(ChromotingInstance); | 297 DISALLOW_COPY_AND_ASSIGN(ChromotingInstance); |
309 }; | 298 }; |
310 | 299 |
311 } // namespace remoting | 300 } // namespace remoting |
312 | 301 |
313 #endif // REMOTING_CLIENT_PLUGIN_CHROMOTING_INSTANCE_H_ | 302 #endif // REMOTING_CLIENT_PLUGIN_CHROMOTING_INSTANCE_H_ |
OLD | NEW |