diff options
author | neb@chromium.org <neb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-19 20:33:13 +0000 |
---|---|---|
committer | neb@chromium.org <neb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-19 20:33:13 +0000 |
commit | 2acaa4de809c66b8b826e3bf93930e2b3bf4c65f (patch) | |
tree | 1badfd2a23265a9f803838a97d5aefdc1941861c /webkit | |
parent | d6b4f43e5ba0048e2d72c2801c694135d32fa7e4 (diff) | |
download | chromium_src-2acaa4de809c66b8b826e3bf93930e2b3bf4c65f.zip chromium_src-2acaa4de809c66b8b826e3bf93930e2b3bf4c65f.tar.gz chromium_src-2acaa4de809c66b8b826e3bf93930e2b3bf4c65f.tar.bz2 |
Added CursorControl Pepper interface.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/3145024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56739 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/plugins/pepper_cursor_control.cc | 91 | ||||
-rw-r--r-- | webkit/glue/plugins/pepper_cursor_control.h | 19 | ||||
-rw-r--r-- | webkit/glue/plugins/pepper_plugin_instance.cc | 20 |
3 files changed, 110 insertions, 20 deletions
diff --git a/webkit/glue/plugins/pepper_cursor_control.cc b/webkit/glue/plugins/pepper_cursor_control.cc new file mode 100644 index 0000000..055e190 --- /dev/null +++ b/webkit/glue/plugins/pepper_cursor_control.cc @@ -0,0 +1,91 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "webkit/glue/plugins/pepper_cursor_control.h" + +#include "base/logging.h" +#include "base/ref_counted.h" +#include "third_party/ppapi/c/pp_cursor_type.h" +#include "third_party/ppapi/c/pp_point.h" +#include "third_party/ppapi/c/pp_resource.h" +#include "third_party/ppapi/c/ppb_cursor_control.h" +#include "webkit/glue/plugins/pepper_image_data.h" +#include "webkit/glue/plugins/pepper_plugin_instance.h" +#include "webkit/glue/plugins/pepper_resource.h" + +namespace pepper { + +namespace { + +bool SetCursor(PP_Instance instance_id, + PP_CursorType type, + PP_Resource custom_image_id, + const PP_Point* hot_spot) { + PluginInstance* instance = PluginInstance::FromPPInstance(instance_id); + if (!instance) + return false; + + scoped_refptr<ImageData> custom_image( + Resource::GetAs<ImageData>(custom_image_id)); + if (custom_image.get()) { + // TODO(neb): implement custom cursors. + NOTIMPLEMENTED(); + return false; + } + + return instance->SetCursor(type); +} + +bool LockCursor(PP_Instance) { + PluginInstance* instance = PluginInstance::FromPPInstance(instance_id); + if (!instance) + return false; + + // TODO(neb): implement cursor locking. + return false; +} + +bool UnlockCursor(PP_Instance) { + PluginInstance* instance = PluginInstance::FromPPInstance(instance_id); + if (!instance) + return false; + + // TODO(neb): implement cursor locking. + return false; +} + +bool HasCursorLock(PP_Instance) { + PluginInstance* instance = PluginInstance::FromPPInstance(instance_id); + if (!instance) + return false; + + // TODO(neb): implement cursor locking. + return false; +} + +bool CanLockCursor(PP_Instance) { + PluginInstance* instance = PluginInstance::FromPPInstance(instance_id); + if (!instance) + return false; + + // TODO(neb): implement cursor locking. + return false; +} + +const PPB_CursorControl cursor_control_interface = { + &SetCursor, + &LockCursor, + &UnlockCursor, + &HasCursorLock, + &CanLockCursor +}; + +} // namespace + +const PPB_CursorControl* GetCursorControlInterface() { + return &cursor_control_interface; +} + +} // namespace pepper + diff --git a/webkit/glue/plugins/pepper_cursor_control.h b/webkit/glue/plugins/pepper_cursor_control.h new file mode 100644 index 0000000..f3e09e1 --- /dev/null +++ b/webkit/glue/plugins/pepper_cursor_control.h @@ -0,0 +1,19 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef WEBKIT_GLUE_PLUGINS_PEPPER_CURSOR_CONTROL_H_ +#define WEBKIT_GLUE_PLUGINS_PEPPER_CURSOR_CONTROL_H_ + +typedef struct _ppb_CursorControl PPB_CursorControl; + +namespace pepper { + +// There's no class implementing CursorControl so we just expose a getter for +// the interface implemented in the .cc file here. +const PPB_CursorControl* GetCursorControlInterface(); + +} // namespace pepper + +#endif // WEBKIT_GLUE_PLUGINS_PEPPER_CURSOR_CONTROL_H_ + diff --git a/webkit/glue/plugins/pepper_plugin_instance.cc b/webkit/glue/plugins/pepper_plugin_instance.cc index 06ee71d..f22a1af 100644 --- a/webkit/glue/plugins/pepper_plugin_instance.cc +++ b/webkit/glue/plugins/pepper_plugin_instance.cc @@ -160,31 +160,11 @@ bool IsFullFrame(PP_Instance instance_id) { return instance->full_frame(); } -bool SetCursor(PP_Instance instance_id, - PP_CursorType type, - PP_Resource custom_image_id, - const PP_Point* hot_spot) { - PluginInstance* instance = PluginInstance::FromPPInstance(instance_id); - if (!instance) - return false; - - scoped_refptr<ImageData> custom_image( - Resource::GetAs<ImageData>(custom_image_id)); - if (custom_image.get()) { - // TODO: implement custom cursors. - NOTIMPLEMENTED(); - return false; - } - - return instance->SetCursor(type); -} - const PPB_Instance ppb_instance = { &GetWindowObject, &GetOwnerElementObject, &BindGraphicsDeviceContext, &IsFullFrame, - &SetCursor, }; void NumberOfFindResultsChanged(PP_Instance instance_id, |