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" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/thread_task_runner_handle.h" | 13 #include "base/thread_task_runner_handle.h" |
14 #include "ppapi/c/pp_instance.h" | 14 #include "ppapi/c/pp_instance.h" |
15 #include "ppapi/c/pp_rect.h" | 15 #include "ppapi/c/pp_rect.h" |
16 #include "ppapi/c/pp_resource.h" | 16 #include "ppapi/c/pp_resource.h" |
17 #include "ppapi/cpp/instance.h" | 17 #include "ppapi/cpp/instance.h" |
18 #include "ppapi/cpp/text_input_controller.h" | 18 #include "ppapi/cpp/text_input_controller.h" |
19 #include "ppapi/cpp/var.h" | 19 #include "ppapi/cpp/var.h" |
20 #include "remoting/client/client_context.h" | 20 #include "remoting/client/client_context.h" |
21 #include "remoting/client/client_user_interface.h" | 21 #include "remoting/client/client_user_interface.h" |
22 #include "remoting/client/key_event_mapper.h" | 22 #include "remoting/client/key_event_mapper.h" |
23 #include "remoting/client/plugin/empty_cursor_filter.h" | 23 #include "remoting/client/plugin/empty_cursor_filter.h" |
24 #include "remoting/client/plugin/media_source_video_renderer.h" | |
25 #include "remoting/client/plugin/pepper_cursor_setter.h" | 24 #include "remoting/client/plugin/pepper_cursor_setter.h" |
26 #include "remoting/client/plugin/pepper_input_handler.h" | 25 #include "remoting/client/plugin/pepper_input_handler.h" |
27 #include "remoting/client/plugin/pepper_plugin_thread_delegate.h" | 26 #include "remoting/client/plugin/pepper_plugin_thread_delegate.h" |
28 #include "remoting/proto/event.pb.h" | 27 #include "remoting/proto/event.pb.h" |
29 #include "remoting/protocol/client_stub.h" | 28 #include "remoting/protocol/client_stub.h" |
30 #include "remoting/protocol/clipboard_stub.h" | 29 #include "remoting/protocol/clipboard_stub.h" |
31 #include "remoting/protocol/connection_to_host.h" | 30 #include "remoting/protocol/connection_to_host.h" |
32 #include "remoting/protocol/cursor_shape_stub.h" | 31 #include "remoting/protocol/cursor_shape_stub.h" |
33 #include "remoting/protocol/input_event_tracker.h" | 32 #include "remoting/protocol/input_event_tracker.h" |
34 #include "remoting/protocol/mouse_input_filter.h" | 33 #include "remoting/protocol/mouse_input_filter.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 class TokenFetcherProxy; | 67 class TokenFetcherProxy; |
69 class PepperView; | 68 class PepperView; |
70 class RectangleUpdateDecoder; | 69 class RectangleUpdateDecoder; |
71 class SignalStrategy; | 70 class SignalStrategy; |
72 class VideoRenderer; | 71 class VideoRenderer; |
73 | 72 |
74 struct ClientConfig; | 73 struct ClientConfig; |
75 | 74 |
76 class ChromotingInstance : | 75 class ChromotingInstance : |
77 public ClientUserInterface, | 76 public ClientUserInterface, |
78 public MediaSourceVideoRenderer::Delegate, | |
79 public protocol::ClipboardStub, | 77 public protocol::ClipboardStub, |
80 public protocol::CursorShapeStub, | 78 public protocol::CursorShapeStub, |
81 public pp::Instance { | 79 public pp::Instance { |
82 public: | 80 public: |
83 // Plugin API version. This should be incremented whenever the API | 81 // Plugin API version. This should be incremented whenever the API |
84 // interface changes. | 82 // interface changes. |
85 static const int kApiVersion = 7; | 83 static const int kApiVersion = 7; |
86 | 84 |
87 // Plugin API features. This allows orthogonal features to be supported | 85 // Plugin API features. This allows orthogonal features to be supported |
88 // without bumping the API version. | 86 // without bumping the API version. |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 void HandleSendClipboardItem(const base::DictionaryValue& data); | 194 void HandleSendClipboardItem(const base::DictionaryValue& data); |
197 void HandleNotifyClientResolution(const base::DictionaryValue& data); | 195 void HandleNotifyClientResolution(const base::DictionaryValue& data); |
198 void HandlePauseVideo(const base::DictionaryValue& data); | 196 void HandlePauseVideo(const base::DictionaryValue& data); |
199 void HandleVideoControl(const base::DictionaryValue& data); | 197 void HandleVideoControl(const base::DictionaryValue& data); |
200 void HandlePauseAudio(const base::DictionaryValue& data); | 198 void HandlePauseAudio(const base::DictionaryValue& data); |
201 void HandleOnPinFetched(const base::DictionaryValue& data); | 199 void HandleOnPinFetched(const base::DictionaryValue& data); |
202 void HandleOnThirdPartyTokenFetched(const base::DictionaryValue& data); | 200 void HandleOnThirdPartyTokenFetched(const base::DictionaryValue& data); |
203 void HandleRequestPairing(const base::DictionaryValue& data); | 201 void HandleRequestPairing(const base::DictionaryValue& data); |
204 void HandleExtensionMessage(const base::DictionaryValue& data); | 202 void HandleExtensionMessage(const base::DictionaryValue& data); |
205 void HandleAllowMouseLockMessage(); | 203 void HandleAllowMouseLockMessage(); |
206 void HandleEnableMediaSourceRendering(); | |
207 void HandleSendMouseInputWhenUnfocused(); | 204 void HandleSendMouseInputWhenUnfocused(); |
208 void HandleDelegateLargeCursors(); | 205 void HandleDelegateLargeCursors(); |
209 | 206 |
210 // Helper method to post messages to the webapp. | 207 // Helper method to post messages to the webapp. |
211 void PostChromotingMessage(const std::string& method, | 208 void PostChromotingMessage(const std::string& method, |
212 const pp::VarDictionary& data); | 209 const pp::VarDictionary& data); |
213 | 210 |
214 // Same as above, but serializes messages to JSON before sending them. This | 211 // Same as above, but serializes messages to JSON before sending them. This |
215 // method is used for backward compatibility with older version of the webapp | 212 // method is used for backward compatibility with older version of the webapp |
216 // that expect to received most messages formatted using JSON. | 213 // that expect to received most messages formatted using JSON. |
(...skipping 18 matching lines...) Expand all Loading... |
235 | 232 |
236 // Returns true if there is a ConnectionToHost and it is connected. | 233 // Returns true if there is a ConnectionToHost and it is connected. |
237 bool IsConnected(); | 234 bool IsConnected(); |
238 | 235 |
239 // Used as the |FetchSecretCallback| for Me2Me connections. | 236 // Used as the |FetchSecretCallback| for Me2Me connections. |
240 // Uses the PIN request dialog in the webapp to obtain the shared secret. | 237 // Uses the PIN request dialog in the webapp to obtain the shared secret. |
241 void FetchSecretFromDialog( | 238 void FetchSecretFromDialog( |
242 bool pairing_supported, | 239 bool pairing_supported, |
243 const protocol::SecretFetchedCallback& secret_fetched_callback); | 240 const protocol::SecretFetchedCallback& secret_fetched_callback); |
244 | 241 |
245 // MediaSourceVideoRenderer::Delegate implementation. | |
246 void OnMediaSourceSize(const webrtc::DesktopSize& size, | |
247 const webrtc::DesktopVector& dpi) override; | |
248 void OnMediaSourceShape(const webrtc::DesktopRegion& shape) override; | |
249 void OnMediaSourceReset(const std::string& format) override; | |
250 void OnMediaSourceData(uint8_t* buffer, | |
251 size_t buffer_size, | |
252 bool keyframe) override; | |
253 | |
254 bool initialized_; | 242 bool initialized_; |
255 | 243 |
256 PepperPluginThreadDelegate plugin_thread_delegate_; | 244 PepperPluginThreadDelegate plugin_thread_delegate_; |
257 scoped_refptr<PluginThreadTaskRunner> plugin_task_runner_; | 245 scoped_refptr<PluginThreadTaskRunner> plugin_task_runner_; |
258 scoped_ptr<base::ThreadTaskRunnerHandle> thread_task_runner_handle_; | 246 scoped_ptr<base::ThreadTaskRunnerHandle> thread_task_runner_handle_; |
259 scoped_ptr<jingle_glue::JingleThreadWrapper> thread_wrapper_; | 247 scoped_ptr<jingle_glue::JingleThreadWrapper> thread_wrapper_; |
260 ClientContext context_; | 248 ClientContext context_; |
261 scoped_ptr<VideoRenderer> video_renderer_; | 249 scoped_ptr<VideoRenderer> video_renderer_; |
262 scoped_ptr<PepperView> view_; | 250 scoped_ptr<PepperView> view_; |
263 scoped_ptr<base::WeakPtrFactory<FrameConsumer> > view_weak_factory_; | 251 scoped_ptr<base::WeakPtrFactory<FrameConsumer> > view_weak_factory_; |
(...skipping 20 matching lines...) Expand all Loading... |
284 scoped_ptr<PepperMouseLocker> mouse_locker_; | 272 scoped_ptr<PepperMouseLocker> mouse_locker_; |
285 EmptyCursorFilter empty_cursor_filter_; | 273 EmptyCursorFilter empty_cursor_filter_; |
286 | 274 |
287 // Used to control text input settings, such as whether to show the IME. | 275 // Used to control text input settings, such as whether to show the IME. |
288 pp::TextInputController text_input_controller_; | 276 pp::TextInputController text_input_controller_; |
289 | 277 |
290 // PIN Fetcher. | 278 // PIN Fetcher. |
291 bool use_async_pin_dialog_; | 279 bool use_async_pin_dialog_; |
292 protocol::SecretFetchedCallback secret_fetched_callback_; | 280 protocol::SecretFetchedCallback secret_fetched_callback_; |
293 | 281 |
294 // Set to true if the webapp has requested to use MediaSource API for | |
295 // rendering. In that case all the encoded video will be passed to the | |
296 // webapp for decoding. | |
297 bool use_media_source_rendering_; | |
298 | |
299 base::WeakPtr<TokenFetcherProxy> token_fetcher_proxy_; | 282 base::WeakPtr<TokenFetcherProxy> token_fetcher_proxy_; |
300 | 283 |
301 // Weak reference to this instance, used for global logging and task posting. | 284 // Weak reference to this instance, used for global logging and task posting. |
302 base::WeakPtrFactory<ChromotingInstance> weak_factory_; | 285 base::WeakPtrFactory<ChromotingInstance> weak_factory_; |
303 | 286 |
304 DISALLOW_COPY_AND_ASSIGN(ChromotingInstance); | 287 DISALLOW_COPY_AND_ASSIGN(ChromotingInstance); |
305 }; | 288 }; |
306 | 289 |
307 } // namespace remoting | 290 } // namespace remoting |
308 | 291 |
309 #endif // REMOTING_CLIENT_PLUGIN_CHROMOTING_INSTANCE_H_ | 292 #endif // REMOTING_CLIENT_PLUGIN_CHROMOTING_INSTANCE_H_ |
OLD | NEW |