Chromium Code Reviews| Index: remoting/client/plugin/chromoting_instance.h |
| diff --git a/remoting/client/plugin/chromoting_instance.h b/remoting/client/plugin/chromoting_instance.h |
| index 3dd36c5d27f29aac6684996dfbcaf46ac8c65c49..2f1d1d6a664b3142c654f80133a354803fdc0b2d 100644 |
| --- a/remoting/client/plugin/chromoting_instance.h |
| +++ b/remoting/client/plugin/chromoting_instance.h |
| @@ -17,7 +17,10 @@ |
| #include "ppapi/c/pp_rect.h" |
| #include "ppapi/c/pp_resource.h" |
| #include "ppapi/cpp/instance.h" |
| +#include "ppapi/cpp/mouse_lock.h" |
| +#include "ppapi/cpp/point.h" |
| #include "ppapi/cpp/var.h" |
| +#include "ppapi/utility/completion_callback_factory.h" |
| #include "remoting/client/client_context.h" |
| #include "remoting/client/client_user_interface.h" |
| #include "remoting/client/key_event_mapper.h" |
| @@ -42,6 +45,7 @@ class DictionaryValue; |
| } // namespace base |
| namespace pp { |
| +class ImageData; |
| class InputEvent; |
| class Module; |
| } // namespace pp |
| @@ -66,7 +70,8 @@ class ChromotingInstance : |
| public ClientUserInterface, |
| public protocol::ClipboardStub, |
| public protocol::CursorShapeStub, |
| - public pp::Instance { |
| + public pp::Instance, |
| + public pp::MouseLock { |
|
Wez
2013/09/05 21:19:38
Have you considered having PepperInputHandler deri
alexeypa (please no reviews)
2013/09/06 20:00:17
Done. Moved it to PepperInputHandler.
|
| public: |
| // Plugin API version. This should be incremented whenever the API |
| // interface changes. |
| @@ -102,12 +107,16 @@ class ChromotingInstance : |
| virtual ~ChromotingInstance(); |
| // pp::Instance interface. |
| + virtual void DidChangeFocus(bool has_focus) OVERRIDE; |
| virtual void DidChangeView(const pp::View& view) OVERRIDE; |
| virtual bool Init(uint32_t argc, const char* argn[], |
| const char* argv[]) OVERRIDE; |
| virtual void HandleMessage(const pp::Var& message) OVERRIDE; |
| virtual bool HandleInputEvent(const pp::InputEvent& event) OVERRIDE; |
| + // pp::MouseLock interface. |
| + virtual void MouseLockLost() OVERRIDE; |
| + |
| // ClientUserInterface interface. |
| virtual void OnConnectionState(protocol::ConnectionToHost::State state, |
| protocol::ErrorCode error) OVERRIDE; |
| @@ -195,6 +204,7 @@ class ChromotingInstance : |
| void HandleOnThirdPartyTokenFetched(const base::DictionaryValue& data); |
| void HandleRequestPairing(const base::DictionaryValue& data); |
| void HandleExtensionMessage(const base::DictionaryValue& data); |
| + void HandleAllowMouseLockMessage(); |
| // Helper method called from Connect() to connect with parsed config. |
| void ConnectWithConfig(const ClientConfig& config, |
| @@ -226,6 +236,19 @@ class ChromotingInstance : |
| bool pairing_supported, |
| const protocol::SecretFetchedCallback& secret_fetched_callback); |
| + // Applies |cursor_image_| as the custom pointer or uses the standard arrow |
| + // pointer if |cursor_image_| is not available. |
| + void EnableMousePointer(); |
| + |
| + // Requests the browser to lock the mouse and hides the cursor. |
| + void RequestMouseLock(); |
| + |
| + // Request the browser and restores the cursor once the lock is gone. |
|
Wez
2013/09/05 20:24:45
This wording seems b0rked!
alexeypa (please no reviews)
2013/09/06 20:00:17
Done.
|
| + void CancelMouseLock(); |
| + |
| + // Called when the browser locked the mouse. |
|
Wez
2013/09/05 20:24:45
nit: Does this take any action? Is this also calle
alexeypa (please no reviews)
2013/09/06 20:00:17
Done.
|
| + void OnMouseLocked(int error); |
| + |
| bool initialized_; |
| PepperPluginThreadDelegate plugin_thread_delegate_; |
| @@ -236,6 +259,26 @@ class ChromotingInstance : |
| scoped_ptr<base::WeakPtrFactory<FrameConsumer> > view_weak_factory_; |
| pp::View plugin_view_; |
| + // True if the plugin is focused. |
|
Wez
2013/09/05 20:24:45
nit: has focus.
alexeypa (please no reviews)
2013/09/06 20:00:17
Done.
|
| + bool focused_; |
|
Wez
2013/09/05 20:24:45
nit: has_focus_;
alexeypa (please no reviews)
2013/09/06 20:00:17
Done.
|
| + |
| + // Custom cursor image sent by the host. When mouse lock is requested |
| + // |cursor_image_| is set to NULL. |
|
Wez
2013/09/05 20:24:45
Why is this set to NULL when mouse-lock is request
alexeypa (please no reviews)
2013/09/06 20:00:17
Done.
|
| + scoped_ptr<pp::ImageData> cursor_image_; |
| + |
| + // Hot spot for |cursor_image_|. |
| + pp::Point cursor_hotspot_; |
| + |
| + enum MouseLockState { |
| + MouseLockDisabled, |
|
Wez
2013/09/05 20:24:45
nit: You've called this state "Disabled", but it's
alexeypa (please no reviews)
2013/09/06 20:00:17
Done.
|
| + MouseLockOff, |
| + MouseLockPending, |
|
Wez
2013/09/05 20:24:45
nit: MouseLockRequested or MouseLockRequestPending
alexeypa (please no reviews)
2013/09/06 20:00:17
Done.
|
| + MouseLockOn, |
| + MouseLockCancelling |
| + }; |
| + |
| + MouseLockState mouse_lock_state_; |
| + |
| // Contains the most-recently-reported desktop shape, if any. |
| scoped_ptr<SkRegion> desktop_shape_; |
| @@ -257,6 +300,8 @@ class ChromotingInstance : |
| base::WeakPtr<PepperTokenFetcher> pepper_token_fetcher_; |
| + pp::CompletionCallbackFactory<ChromotingInstance> callback_factory_; |
| + |
| // Weak reference to this instance, used for global logging and task posting. |
| base::WeakPtrFactory<ChromotingInstance> weak_factory_; |