From 366e3005fbea54d2a7da5403c9c11a286b5cbd55 Mon Sep 17 00:00:00 2001 From: "jam@chromium.org" Date: Wed, 14 Jul 2010 18:11:08 +0000 Subject: Hookup pepper v2 zoom interface. Review URL: http://codereview.chromium.org/2900012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52347 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/glue/plugins/pepper_plugin_instance.cc | 18 ++++++++++++++++-- webkit/glue/plugins/pepper_plugin_instance.h | 9 ++++++--- 2 files changed, 22 insertions(+), 5 deletions(-) (limited to 'webkit') diff --git a/webkit/glue/plugins/pepper_plugin_instance.cc b/webkit/glue/plugins/pepper_plugin_instance.cc index 35b254f..89e8284 100644 --- a/webkit/glue/plugins/pepper_plugin_instance.cc +++ b/webkit/glue/plugins/pepper_plugin_instance.cc @@ -17,6 +17,7 @@ #include "third_party/ppapi/c/ppb_instance.h" #include "third_party/ppapi/c/ppp_find.h" #include "third_party/ppapi/c/ppp_instance.h" +#include "third_party/ppapi/c/ppp_zoom.h" #include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h" #include "third_party/WebKit/WebKit/chromium/public/WebDocument.h" #include "third_party/WebKit/WebKit/chromium/public/WebElement.h" @@ -200,7 +201,8 @@ PluginInstance::PluginInstance(PluginDelegate* delegate, container_(NULL), full_frame_(false), find_identifier_(-1), - plugin_find_interface_(NULL) { + plugin_find_interface_(NULL), + plugin_zoom_interface_(NULL) { DCHECK(delegate); module_->InstanceCreated(this); delegate_->InstanceCreated(this); @@ -381,7 +383,9 @@ string16 PluginInstance::GetSelectedText(bool html) { } void PluginInstance::Zoom(float factor, bool text_only) { - // TODO: implement me + if (!LoadZoomInterface()) + return; + plugin_zoom_interface_->Zoom(GetPPInstance(), factor, text_only); } bool PluginInstance::StartFind(const string16& search_text, @@ -418,4 +422,14 @@ bool PluginInstance::LoadFindInterface() { return !!plugin_find_interface_; } +bool PluginInstance::LoadZoomInterface() { + if (!plugin_zoom_interface_) { + plugin_zoom_interface_ = + reinterpret_cast(module_->GetPluginInterface( + PPP_ZOOM_INTERFACE)); + } + + return !!plugin_zoom_interface_; +} + } // namespace pepper diff --git a/webkit/glue/plugins/pepper_plugin_instance.h b/webkit/glue/plugins/pepper_plugin_instance.h index 4ffce28..0ed2603 100644 --- a/webkit/glue/plugins/pepper_plugin_instance.h +++ b/webkit/glue/plugins/pepper_plugin_instance.h @@ -16,13 +16,14 @@ #include "third_party/ppapi/c/pp_cursor_type.h" #include "third_party/ppapi/c/pp_instance.h" #include "third_party/ppapi/c/pp_resource.h" -#include "third_party/ppapi/c/ppb_find.h" -#include "third_party/ppapi/c/ppp_find.h" #include "third_party/WebKit/WebKit/chromium/public/WebCanvas.h" typedef struct _pp_Var PP_Var; typedef struct _ppb_Instance PPB_Instance; +typedef struct _ppb_Find PPB_Find; +typedef struct _ppp_Find PPP_Find; typedef struct _ppp_Instance PPP_Instance; +typedef struct _ppp_Zoom PPP_Zoom; namespace gfx { class Rect; @@ -115,6 +116,7 @@ class PluginInstance : public base::RefCounted { private: bool LoadFindInterface(); + bool LoadZoomInterface(); PluginDelegate* delegate_; scoped_refptr module_; @@ -143,8 +145,9 @@ class PluginInstance : public base::RefCounted { // The id of the current find operation, or -1 if none is in process. int find_identifier_; - // The plugin find interface. + // The plugin find and zoom interfaces. const PPP_Find* plugin_find_interface_; + const PPP_Zoom* plugin_zoom_interface_; // Containes the cursor if it's set by the plugin. scoped_ptr cursor_; -- cgit v1.1