| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPAPI_WEBPLUGIN_IMPL_H_ | |
| 6 #define WEBKIT_PLUGINS_PPAPI_PPAPI_WEBPLUGIN_IMPL_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "base/memory/weak_ptr.h" | |
| 13 #include "base/sequenced_task_runner_helpers.h" | |
| 14 #include "ppapi/c/pp_var.h" | |
| 15 #include "third_party/WebKit/public/web/WebPlugin.h" | |
| 16 #include "ui/gfx/rect.h" | |
| 17 #include "webkit/plugins/webkit_plugins_export.h" | |
| 18 | |
| 19 struct _NPP; | |
| 20 | |
| 21 namespace content { | |
| 22 class RenderView; | |
| 23 } | |
| 24 | |
| 25 namespace WebKit { | |
| 26 struct WebPluginParams; | |
| 27 struct WebPrintParams; | |
| 28 } | |
| 29 | |
| 30 namespace webkit { | |
| 31 namespace ppapi { | |
| 32 | |
| 33 class PluginDelegate; | |
| 34 class PluginInstanceImpl; | |
| 35 class PluginModule; | |
| 36 class PPB_URLLoader_Impl; | |
| 37 | |
| 38 class WebPluginImpl : public WebKit::WebPlugin { | |
| 39 public: | |
| 40 WEBKIT_PLUGINS_EXPORT WebPluginImpl( | |
| 41 PluginModule* module, | |
| 42 const WebKit::WebPluginParams& params, | |
| 43 const base::WeakPtr<PluginDelegate>& plugin_delegate, | |
| 44 const base::WeakPtr<content::RenderView>& render_view); | |
| 45 | |
| 46 PluginInstanceImpl* instance() { return instance_.get(); } | |
| 47 | |
| 48 // WebKit::WebPlugin implementation. | |
| 49 virtual WebKit::WebPluginContainer* container() const; | |
| 50 virtual bool initialize(WebKit::WebPluginContainer* container); | |
| 51 virtual void destroy(); | |
| 52 virtual NPObject* scriptableObject(); | |
| 53 virtual struct _NPP* pluginNPP(); | |
| 54 virtual bool getFormValue(WebKit::WebString& value); | |
| 55 virtual void paint(WebKit::WebCanvas* canvas, const WebKit::WebRect& rect); | |
| 56 virtual void updateGeometry( | |
| 57 const WebKit::WebRect& frame_rect, | |
| 58 const WebKit::WebRect& clip_rect, | |
| 59 const WebKit::WebVector<WebKit::WebRect>& cut_outs_rects, | |
| 60 bool is_visible); | |
| 61 virtual void updateFocus(bool focused); | |
| 62 virtual void updateVisibility(bool visible); | |
| 63 virtual bool acceptsInputEvents(); | |
| 64 virtual bool handleInputEvent(const WebKit::WebInputEvent& event, | |
| 65 WebKit::WebCursorInfo& cursor_info); | |
| 66 virtual void didReceiveResponse(const WebKit::WebURLResponse& response); | |
| 67 virtual void didReceiveData(const char* data, int data_length); | |
| 68 virtual void didFinishLoading(); | |
| 69 virtual void didFailLoading(const WebKit::WebURLError&); | |
| 70 virtual void didFinishLoadingFrameRequest(const WebKit::WebURL& url, | |
| 71 void* notify_data); | |
| 72 virtual void didFailLoadingFrameRequest(const WebKit::WebURL& url, | |
| 73 void* notify_data, | |
| 74 const WebKit::WebURLError& error); | |
| 75 virtual bool hasSelection() const; | |
| 76 virtual WebKit::WebString selectionAsText() const; | |
| 77 virtual WebKit::WebString selectionAsMarkup() const; | |
| 78 virtual WebKit::WebURL linkAtPosition(const WebKit::WebPoint& position) const; | |
| 79 virtual void setZoomLevel(double level, bool text_only); | |
| 80 virtual bool startFind(const WebKit::WebString& search_text, | |
| 81 bool case_sensitive, | |
| 82 int identifier); | |
| 83 virtual void selectFindResult(bool forward); | |
| 84 virtual void stopFind(); | |
| 85 virtual bool supportsPaginatedPrint() OVERRIDE; | |
| 86 virtual bool isPrintScalingDisabled() OVERRIDE; | |
| 87 | |
| 88 virtual int printBegin(const WebKit::WebPrintParams& print_params) OVERRIDE; | |
| 89 virtual bool printPage(int page_number, WebKit::WebCanvas* canvas) OVERRIDE; | |
| 90 virtual void printEnd() OVERRIDE; | |
| 91 | |
| 92 virtual bool canRotateView() OVERRIDE; | |
| 93 virtual void rotateView(RotationType type) OVERRIDE; | |
| 94 virtual bool isPlaceholder() OVERRIDE; | |
| 95 | |
| 96 private: | |
| 97 friend class base::DeleteHelper<WebPluginImpl>; | |
| 98 | |
| 99 WEBKIT_PLUGINS_EXPORT virtual ~WebPluginImpl(); | |
| 100 struct InitData; | |
| 101 | |
| 102 scoped_ptr<InitData> init_data_; // Cleared upon successful initialization. | |
| 103 // True if the instance represents the entire document in a frame instead of | |
| 104 // being an embedded resource. | |
| 105 bool full_frame_; | |
| 106 scoped_refptr<PluginInstanceImpl> instance_; | |
| 107 gfx::Rect plugin_rect_; | |
| 108 PP_Var instance_object_; | |
| 109 WebKit::WebPluginContainer* container_; | |
| 110 | |
| 111 DISALLOW_COPY_AND_ASSIGN(WebPluginImpl); | |
| 112 }; | |
| 113 | |
| 114 } // namespace ppapi | |
| 115 } // namespace webkit | |
| 116 | |
| 117 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_WEBPLUGIN_IMPL_H_ | |
| OLD | NEW |