Roll leveldb from r73 to r75.
[chromium-blink-merge.git] / ppapi / cpp / dev / cursor_control_dev.cc
blob6df0107098df205aa7f3a8a1df08b68ded105e7e
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
3 // found in the LICENSE file.
5 #include "ppapi/cpp/dev/cursor_control_dev.h"
7 #include "ppapi/cpp/image_data.h"
8 #include "ppapi/cpp/instance_handle.h"
9 #include "ppapi/cpp/module.h"
10 #include "ppapi/cpp/module_impl.h"
11 #include "ppapi/cpp/point.h"
13 namespace pp {
15 namespace {
17 template <> const char* interface_name<PPB_CursorControl_Dev_0_4>() {
18 return PPB_CURSOR_CONTROL_DEV_INTERFACE_0_4;
21 } // namespace
23 bool CursorControl_Dev::SetCursor(const InstanceHandle& instance,
24 PP_CursorType_Dev type,
25 const ImageData& custom_image,
26 const Point& hot_spot) {
27 if (has_interface<PPB_CursorControl_Dev_0_4>()) {
28 return PP_ToBool(get_interface<PPB_CursorControl_Dev_0_4>()->SetCursor(
29 instance.pp_instance(), type, custom_image.pp_resource(),
30 &hot_spot.pp_point()));
32 return false;
35 bool LockCursor(const InstanceHandle& instance) {
36 if (has_interface<PPB_CursorControl_Dev_0_4>()) {
37 return PP_ToBool(get_interface<PPB_CursorControl_Dev_0_4>()->LockCursor(
38 instance.pp_instance()));
40 return false;
43 bool UnlockCursor(const InstanceHandle& instance) {
44 if (has_interface<PPB_CursorControl_Dev_0_4>()) {
45 return PP_ToBool(get_interface<PPB_CursorControl_Dev_0_4>()->UnlockCursor(
46 instance.pp_instance()));
48 return false;
51 bool HasCursorLock(const InstanceHandle& instance) {
52 if (has_interface<PPB_CursorControl_Dev_0_4>()) {
53 return PP_ToBool(get_interface<PPB_CursorControl_Dev_0_4>()->HasCursorLock(
54 instance.pp_instance()));
56 return false;
59 bool CanLockCursor(const InstanceHandle& instance) {
60 if (has_interface<PPB_CursorControl_Dev_0_4>()) {
61 return PP_ToBool(get_interface<PPB_CursorControl_Dev_0_4>()->CanLockCursor(
62 instance.pp_instance()));
64 return false;
67 } // namespace pp