Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(505)

Side by Side Diff: components/plugins/renderer/webview_plugin.h

Issue 63273002: Rename WebKit namespace to blink (part 4) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_ 5 #ifndef COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_
6 #define COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_ 6 #define COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_
7 7
8 #include <list> 8 #include <list>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/sequenced_task_runner_helpers.h" 11 #include "base/sequenced_task_runner_helpers.h"
12 #include "third_party/WebKit/public/platform/WebString.h" 12 #include "third_party/WebKit/public/platform/WebString.h"
13 #include "third_party/WebKit/public/platform/WebURLResponse.h" 13 #include "third_party/WebKit/public/platform/WebURLResponse.h"
14 #include "third_party/WebKit/public/web/WebCursorInfo.h" 14 #include "third_party/WebKit/public/web/WebCursorInfo.h"
15 #include "third_party/WebKit/public/web/WebFrameClient.h" 15 #include "third_party/WebKit/public/web/WebFrameClient.h"
16 #include "third_party/WebKit/public/web/WebPlugin.h" 16 #include "third_party/WebKit/public/web/WebPlugin.h"
17 #include "third_party/WebKit/public/web/WebViewClient.h" 17 #include "third_party/WebKit/public/web/WebViewClient.h"
18 18
19 struct WebPreferences; 19 struct WebPreferences;
20 20
21 namespace WebKit { 21 namespace blink {
22 class WebMouseEvent; 22 class WebMouseEvent;
23 } 23 }
24 24
25 // This class implements the WebPlugin interface by forwarding drawing and 25 // This class implements the WebPlugin interface by forwarding drawing and
26 // handling input events to a WebView. 26 // handling input events to a WebView.
27 // It can be used as a placeholder for an actual plugin, using HTML for the UI. 27 // It can be used as a placeholder for an actual plugin, using HTML for the UI.
28 // To show HTML data inside the WebViewPlugin, 28 // To show HTML data inside the WebViewPlugin,
29 // call web_view->mainFrame()->loadHTMLString() with the HTML data and a fake 29 // call web_view->mainFrame()->loadHTMLString() with the HTML data and a fake
30 // chrome:// URL as origin. 30 // chrome:// URL as origin.
31 31
32 class WebViewPlugin : public WebKit::WebPlugin, 32 class WebViewPlugin : public blink::WebPlugin,
33 public WebKit::WebViewClient, 33 public blink::WebViewClient,
34 public WebKit::WebFrameClient { 34 public blink::WebFrameClient {
35 public: 35 public:
36 class Delegate { 36 class Delegate {
37 public: 37 public:
38 // Bind |frame| to a Javascript object, enabling the delegate to receive 38 // Bind |frame| to a Javascript object, enabling the delegate to receive
39 // callback methods from Javascript inside the WebFrame. 39 // callback methods from Javascript inside the WebFrame.
40 // This method is called from WebFrameClient::didClearWindowObject. 40 // This method is called from WebFrameClient::didClearWindowObject.
41 virtual void BindWebFrame(WebKit::WebFrame* frame) = 0; 41 virtual void BindWebFrame(blink::WebFrame* frame) = 0;
42 42
43 // Called before the WebViewPlugin is destroyed. The delegate should delete 43 // Called before the WebViewPlugin is destroyed. The delegate should delete
44 // itself here. 44 // itself here.
45 virtual void WillDestroyPlugin() = 0; 45 virtual void WillDestroyPlugin() = 0;
46 46
47 // Called upon a context menu event. 47 // Called upon a context menu event.
48 virtual void ShowContextMenu(const WebKit::WebMouseEvent&) = 0; 48 virtual void ShowContextMenu(const blink::WebMouseEvent&) = 0;
49 }; 49 };
50 50
51 explicit WebViewPlugin(Delegate* delegate); 51 explicit WebViewPlugin(Delegate* delegate);
52 52
53 // Convenience method to set up a new WebViewPlugin using |preferences| 53 // Convenience method to set up a new WebViewPlugin using |preferences|
54 // and displaying |html_data|. |url| should be a (fake) chrome:// URL; it is 54 // and displaying |html_data|. |url| should be a (fake) chrome:// URL; it is
55 // only used for navigation and never actually resolved. 55 // only used for navigation and never actually resolved.
56 static WebViewPlugin* Create(Delegate* delegate, 56 static WebViewPlugin* Create(Delegate* delegate,
57 const WebPreferences& preferences, 57 const WebPreferences& preferences,
58 const std::string& html_data, 58 const std::string& html_data,
59 const GURL& url); 59 const GURL& url);
60 60
61 WebKit::WebView* web_view() { return web_view_; } 61 blink::WebView* web_view() { return web_view_; }
62 62
63 // When loading a plug-in document (i.e. a full page plug-in not embedded in 63 // When loading a plug-in document (i.e. a full page plug-in not embedded in
64 // another page), we save all data that has been received, and replay it with 64 // another page), we save all data that has been received, and replay it with
65 // this method on the actual plug-in. 65 // this method on the actual plug-in.
66 void ReplayReceivedData(WebKit::WebPlugin* plugin); 66 void ReplayReceivedData(blink::WebPlugin* plugin);
67 67
68 void RestoreTitleText(); 68 void RestoreTitleText();
69 69
70 // WebPlugin methods: 70 // WebPlugin methods:
71 virtual WebKit::WebPluginContainer* container() const; 71 virtual blink::WebPluginContainer* container() const;
72 virtual bool initialize(WebKit::WebPluginContainer*); 72 virtual bool initialize(blink::WebPluginContainer*);
73 virtual void destroy(); 73 virtual void destroy();
74 74
75 virtual NPObject* scriptableObject(); 75 virtual NPObject* scriptableObject();
76 virtual struct _NPP* pluginNPP(); 76 virtual struct _NPP* pluginNPP();
77 77
78 virtual bool getFormValue(WebKit::WebString& value); 78 virtual bool getFormValue(blink::WebString& value);
79 79
80 virtual void paint(WebKit::WebCanvas* canvas, const WebKit::WebRect& rect); 80 virtual void paint(blink::WebCanvas* canvas, const blink::WebRect& rect);
81 81
82 // Coordinates are relative to the containing window. 82 // Coordinates are relative to the containing window.
83 virtual void updateGeometry( 83 virtual void updateGeometry(
84 const WebKit::WebRect& frame_rect, 84 const blink::WebRect& frame_rect,
85 const WebKit::WebRect& clip_rect, 85 const blink::WebRect& clip_rect,
86 const WebKit::WebVector<WebKit::WebRect>& cut_out_rects, 86 const blink::WebVector<blink::WebRect>& cut_out_rects,
87 bool is_visible); 87 bool is_visible);
88 88
89 virtual void updateFocus(bool) {} 89 virtual void updateFocus(bool) {}
90 virtual void updateVisibility(bool) {} 90 virtual void updateVisibility(bool) {}
91 91
92 virtual bool acceptsInputEvents(); 92 virtual bool acceptsInputEvents();
93 virtual bool handleInputEvent(const WebKit::WebInputEvent& event, 93 virtual bool handleInputEvent(const blink::WebInputEvent& event,
94 WebKit::WebCursorInfo& cursor_info); 94 blink::WebCursorInfo& cursor_info);
95 95
96 virtual void didReceiveResponse(const WebKit::WebURLResponse& response); 96 virtual void didReceiveResponse(const blink::WebURLResponse& response);
97 virtual void didReceiveData(const char* data, int data_length); 97 virtual void didReceiveData(const char* data, int data_length);
98 virtual void didFinishLoading(); 98 virtual void didFinishLoading();
99 virtual void didFailLoading(const WebKit::WebURLError& error); 99 virtual void didFailLoading(const blink::WebURLError& error);
100 100
101 // Called in response to WebPluginContainer::loadFrameRequest 101 // Called in response to WebPluginContainer::loadFrameRequest
102 virtual void didFinishLoadingFrameRequest(const WebKit::WebURL& url, 102 virtual void didFinishLoadingFrameRequest(const blink::WebURL& url,
103 void* notifyData) {} 103 void* notifyData) {}
104 virtual void didFailLoadingFrameRequest(const WebKit::WebURL& url, 104 virtual void didFailLoadingFrameRequest(const blink::WebURL& url,
105 void* notify_data, 105 void* notify_data,
106 const WebKit::WebURLError& error) {} 106 const blink::WebURLError& error) {}
107 107
108 // WebViewClient methods: 108 // WebViewClient methods:
109 virtual bool acceptsLoadDrops(); 109 virtual bool acceptsLoadDrops();
110 110
111 virtual void setToolTipText(const WebKit::WebString&, 111 virtual void setToolTipText(const blink::WebString&,
112 WebKit::WebTextDirection); 112 blink::WebTextDirection);
113 113
114 virtual void startDragging(WebKit::WebFrame* frame, 114 virtual void startDragging(blink::WebFrame* frame,
115 const WebKit::WebDragData& drag_data, 115 const blink::WebDragData& drag_data,
116 WebKit::WebDragOperationsMask mask, 116 blink::WebDragOperationsMask mask,
117 const WebKit::WebImage& image, 117 const blink::WebImage& image,
118 const WebKit::WebPoint& point); 118 const blink::WebPoint& point);
119 119
120 // WebWidgetClient methods: 120 // WebWidgetClient methods:
121 virtual void didInvalidateRect(const WebKit::WebRect&); 121 virtual void didInvalidateRect(const blink::WebRect&);
122 virtual void didChangeCursor(const WebKit::WebCursorInfo& cursor); 122 virtual void didChangeCursor(const blink::WebCursorInfo& cursor);
123 123
124 // WebFrameClient methods: 124 // WebFrameClient methods:
125 virtual void didClearWindowObject(WebKit::WebFrame* frame); 125 virtual void didClearWindowObject(blink::WebFrame* frame);
126 126
127 // This method is defined in WebPlugin as well as in WebFrameClient, but with 127 // This method is defined in WebPlugin as well as in WebFrameClient, but with
128 // different parameters. We only care about implementing the WebPlugin 128 // different parameters. We only care about implementing the WebPlugin
129 // version, so we implement this method and call the default in WebFrameClient 129 // version, so we implement this method and call the default in WebFrameClient
130 // (which does nothing) to correctly overload it. 130 // (which does nothing) to correctly overload it.
131 virtual void didReceiveResponse(WebKit::WebFrame* frame, 131 virtual void didReceiveResponse(blink::WebFrame* frame,
132 unsigned identifier, 132 unsigned identifier,
133 const WebKit::WebURLResponse& response); 133 const blink::WebURLResponse& response);
134 134
135 private: 135 private:
136 friend class base::DeleteHelper<WebViewPlugin>; 136 friend class base::DeleteHelper<WebViewPlugin>;
137 virtual ~WebViewPlugin(); 137 virtual ~WebViewPlugin();
138 138
139 Delegate* delegate_; 139 Delegate* delegate_;
140 // Destroys itself. 140 // Destroys itself.
141 WebKit::WebCursorInfo current_cursor_; 141 blink::WebCursorInfo current_cursor_;
142 // Owns us. 142 // Owns us.
143 WebKit::WebPluginContainer* container_; 143 blink::WebPluginContainer* container_;
144 // Owned by us, deleted via |close()|. 144 // Owned by us, deleted via |close()|.
145 WebKit::WebView* web_view_; 145 blink::WebView* web_view_;
146 gfx::Rect rect_; 146 gfx::Rect rect_;
147 147
148 WebKit::WebURLResponse response_; 148 blink::WebURLResponse response_;
149 std::list<std::string> data_; 149 std::list<std::string> data_;
150 bool finished_loading_; 150 bool finished_loading_;
151 scoped_ptr<WebKit::WebURLError> error_; 151 scoped_ptr<blink::WebURLError> error_;
152 WebKit::WebString old_title_; 152 blink::WebString old_title_;
153 }; 153 };
154 154
155 #endif // COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_ 155 #endif // COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_
OLDNEW
« no previous file with comments | « components/plugins/renderer/plugin_placeholder.cc ('k') | components/plugins/renderer/webview_plugin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698