blob: daff3a5248961c702d97562b5accfecf486a46f3 [file] [log] [blame]
wez147370142014-11-24 19:10:501// 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.
4
5#ifndef REMOTING_CLIENT_PLUGIN_PEPPER_CURSOR_SETTER_H_
6#define REMOTING_CLIENT_PLUGIN_PEPPER_CURSOR_SETTER_H_
7
avi5a080f012015-12-22 23:15:438#include "base/macros.h"
wez147370142014-11-24 19:10:509#include "ppapi/cpp/instance_handle.h"
10#include "remoting/protocol/cursor_shape_stub.h"
11
12namespace remoting {
13
14// Helper that applies supplied cursor shapes to the plugin.
15class PepperCursorSetter : public protocol::CursorShapeStub {
16 public:
17 explicit PepperCursorSetter(const pp::InstanceHandle& instance);
18 ~PepperCursorSetter() override;
19
20 // protocol::CursorShapeStub interface.
21 void SetCursorShape(const protocol::CursorShapeInfo& cursor_shape) override;
22
23 // Sets a CursorShapeStub to which the cursor will be delegated if it cannot
24 // be set via PPAPI.
25 void set_delegate_stub(protocol::CursorShapeStub* delegate_stub) {
26 delegate_stub_ = delegate_stub;
27 }
28
29 // Maximum width and height of a mouse cursor supported by PPAPI.
30 static const int kMaxCursorWidth = 32;
31 static const int kMaxCursorHeight = 32;
32
33 private:
34 // Attempts to set the supplied cursor via PPAPI, returning true on success.
35 bool SetInstanceCursor(const protocol::CursorShapeInfo& cursor_shape);
36
37 pp::InstanceHandle instance_;
38 protocol::CursorShapeStub* delegate_stub_;
39
40 DISALLOW_COPY_AND_ASSIGN(PepperCursorSetter);
41};
42
43} // namespace remoting
44
45#endif // REMOTING_CLIENT_PLUGIN_PEPPER_CURSOR_SETTER_H_