Index: components/plugins/renderer/webview_plugin.h |
diff --git a/components/plugins/renderer/webview_plugin.h b/components/plugins/renderer/webview_plugin.h |
index 712fc0e8bfd3e866790cf639301d41cafbec7fa3..7f4ad1045a850bad918d6c85c898a0247a61a71a 100644 |
--- a/components/plugins/renderer/webview_plugin.h |
+++ b/components/plugins/renderer/webview_plugin.h |
@@ -36,7 +36,6 @@ struct WebPreferences; |
// chrome:// URL as origin. |
class WebViewPlugin : public blink::WebPlugin, |
- public blink::WebViewClient, |
public content::RenderViewObserver { |
public: |
class Delegate { |
@@ -67,11 +66,15 @@ class WebViewPlugin : public blink::WebPlugin, |
const std::string& html_data, |
const GURL& url); |
- blink::WebView* web_view() { return web_view_; } |
+ blink::WebView* web_view() { return web_view_helper_.web_view(); } |
- bool focused() const { return focused_; } |
const blink::WebString& old_title() const { return old_title_; } |
+ // When loading a plugin document (i.e. a full page plugin not embedded in |
+ // another page), we save all data that has been received, and replay it with |
+ // this method on the actual plugin. |
+ void ReplayReceivedData(blink::WebPlugin* plugin); |
+ |
// WebPlugin methods: |
blink::WebPluginContainer* container() const override; |
// The WebViewPlugin, by design, never fails to initialize. It's used to |
@@ -103,27 +106,6 @@ class WebViewPlugin : public blink::WebPlugin, |
void didFinishLoading() override; |
void didFailLoading(const blink::WebURLError& error) override; |
- // WebViewClient methods: |
- bool acceptsLoadDrops() override; |
- |
- void setToolTipText(const blink::WebString&, |
- blink::WebTextDirection) override; |
- |
- void startDragging(blink::WebReferrerPolicy, |
- const blink::WebDragData&, |
- blink::WebDragOperationsMask, |
- const blink::WebImage&, |
- const blink::WebPoint&) override; |
- |
- // TODO(ojan): Remove this override and have this class use a non-null |
- // layerTreeView. |
- bool allowsBrokenNullLayerTreeView() const override; |
- |
- // WebWidgetClient methods: |
- void didInvalidateRect(const blink::WebRect&) override; |
- void didChangeCursor(const blink::WebCursorInfo& cursor) override; |
- void scheduleAnimation() override; |
- |
private: |
friend class base::DeleteHelper<WebViewPlugin>; |
WebViewPlugin(content::RenderView* render_view, |
@@ -132,7 +114,7 @@ class WebViewPlugin : public blink::WebPlugin, |
~WebViewPlugin() override; |
// content::RenderViewObserver methods: |
- void OnDestruct() override; |
+ void OnDestruct() override {} |
void OnZoomLevelChanged() override; |
void UpdatePluginForNewGeometry(const blink::WebRect& window_rect, |
@@ -146,27 +128,55 @@ class WebViewPlugin : public blink::WebPlugin, |
// Owns us. |
blink::WebPluginContainer* container_; |
- // Owned by us, deleted via |close()|. |
- blink::WebView* web_view_; |
- |
gfx::Rect rect_; |
+ blink::WebURLResponse response_; |
+ std::list<std::string> data_; |
+ std::unique_ptr<blink::WebURLError> error_; |
blink::WebString old_title_; |
+ bool finished_loading_; |
bool focused_; |
bool is_painting_; |
bool is_resizing_; |
- // A helper needed to create a WebLocalFrame. |
- class PluginWebFrameClient : public blink::WebFrameClient { |
+ // A helper that handles interaction from WebViewPlugin's internal WebView. |
+ class WebViewHelper : public blink::WebViewClient, |
+ public blink::WebFrameClient { |
public: |
- PluginWebFrameClient(WebViewPlugin* plugin) : plugin_(plugin) {} |
- ~PluginWebFrameClient() override {} |
+ WebViewHelper(WebViewPlugin* plugin, |
+ const content::WebPreferences& preferences); |
+ ~WebViewHelper() override; |
+ |
+ blink::WebView* web_view() { return web_view_; } |
+ |
+ // WebViewClient methods: |
+ bool acceptsLoadDrops() override; |
+ |
+ // WebWidgetClient methods: |
+ void setToolTipText(const blink::WebString&, |
+ blink::WebTextDirection) override; |
+ void startDragging(blink::WebReferrerPolicy, |
+ const blink::WebDragData&, |
+ blink::WebDragOperationsMask, |
+ const blink::WebImage&, |
+ const blink::WebPoint&) override; |
+ // TODO(ojan): Remove this override and have this class use a non-null |
+ // layerTreeView. |
+ bool allowsBrokenNullLayerTreeView() const override; |
+ void didInvalidateRect(const blink::WebRect&) override; |
+ void didChangeCursor(const blink::WebCursorInfo& cursor) override; |
+ void scheduleAnimation() override; |
+ |
+ // WebFrameClient methods: |
void didClearWindowObject(blink::WebLocalFrame* frame) override; |
private: |
WebViewPlugin* plugin_; |
+ |
+ // Owned by us, deleted via |close()|. |
+ blink::WebView* web_view_; |
}; |
- PluginWebFrameClient web_frame_client_; |
+ WebViewHelper web_view_helper_; |
// Should be invalidated when destroy() is called. |
base::WeakPtrFactory<WebViewPlugin> weak_factory_; |