diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-14 18:11:08 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-14 18:11:08 +0000 |
commit | 366e3005fbea54d2a7da5403c9c11a286b5cbd55 (patch) | |
tree | 033996dc8bd39e1fab8ece5bfd5a162188046442 /webkit | |
parent | f1d9428ecf3a598fb8bc86c9e1f8707dc6bd73cb (diff) | |
download | chromium_src-366e3005fbea54d2a7da5403c9c11a286b5cbd55.zip chromium_src-366e3005fbea54d2a7da5403c9c11a286b5cbd55.tar.gz chromium_src-366e3005fbea54d2a7da5403c9c11a286b5cbd55.tar.bz2 |
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
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/plugins/pepper_plugin_instance.cc | 18 | ||||
-rw-r--r-- | webkit/glue/plugins/pepper_plugin_instance.h | 9 |
2 files changed, 22 insertions, 5 deletions
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<const PPP_Zoom*>(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<PluginInstance> { private: bool LoadFindInterface(); + bool LoadZoomInterface(); PluginDelegate* delegate_; scoped_refptr<PluginModule> module_; @@ -143,8 +145,9 @@ class PluginInstance : public base::RefCounted<PluginInstance> { // 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<WebKit::WebCursorInfo> cursor_; |