Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / remoting / client / plugin / pepper_cursor_setter.h
blob1989599abd5fc2fd8e8fdcac35afa217ff3f152e
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef REMOTING_CLIENT_PLUGIN_PEPPER_CURSOR_SETTER_H_
6 #define REMOTING_CLIENT_PLUGIN_PEPPER_CURSOR_SETTER_H_
8 #include "ppapi/cpp/instance_handle.h"
9 #include "remoting/protocol/cursor_shape_stub.h"
11 namespace remoting {
13 // Helper that applies supplied cursor shapes to the plugin.
14 class PepperCursorSetter : public protocol::CursorShapeStub {
15 public:
16 explicit PepperCursorSetter(const pp::InstanceHandle& instance);
17 ~PepperCursorSetter() override;
19 // protocol::CursorShapeStub interface.
20 void SetCursorShape(const protocol::CursorShapeInfo& cursor_shape) override;
22 // Sets a CursorShapeStub to which the cursor will be delegated if it cannot
23 // be set via PPAPI.
24 void set_delegate_stub(protocol::CursorShapeStub* delegate_stub) {
25 delegate_stub_ = delegate_stub;
28 // Maximum width and height of a mouse cursor supported by PPAPI.
29 static const int kMaxCursorWidth = 32;
30 static const int kMaxCursorHeight = 32;
32 private:
33 // Attempts to set the supplied cursor via PPAPI, returning true on success.
34 bool SetInstanceCursor(const protocol::CursorShapeInfo& cursor_shape);
36 pp::InstanceHandle instance_;
37 protocol::CursorShapeStub* delegate_stub_;
39 DISALLOW_COPY_AND_ASSIGN(PepperCursorSetter);
42 } // namespace remoting
44 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_CURSOR_SETTER_H_