Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 48 | 48 |
| 49 // Called when the WebViewPlugin is destroyed. | 49 // Called when the WebViewPlugin is destroyed. |
| 50 virtual void PluginDestroyed() = 0; | 50 virtual void PluginDestroyed() = 0; |
| 51 | 51 |
| 52 // Called to enable JavaScript pass-through to a throttled plugin, which is | 52 // Called to enable JavaScript pass-through to a throttled plugin, which is |
| 53 // loaded but idle. Doesn't work for blocked plugins, which is not loaded. | 53 // loaded but idle. Doesn't work for blocked plugins, which is not loaded. |
| 54 virtual v8::Local<v8::Object> GetV8ScriptableObject(v8::Isolate*) const = 0; | 54 virtual v8::Local<v8::Object> GetV8ScriptableObject(v8::Isolate*) const = 0; |
| 55 | 55 |
| 56 // Called when the unobscured rect of the plugin is updated. | 56 // Called when the unobscured rect of the plugin is updated. |
| 57 virtual void OnUnobscuredRectUpdate(const gfx::Rect& unobscured_rect) {} | 57 virtual void OnUnobscuredRectUpdate(const gfx::Rect& unobscured_rect) {} |
| 58 | |
| 59 virtual bool IsErrorplaceholder() = 0; | |
|
tommycli
2017/04/03 22:15:49
Yes, to echo bauerb, this should be IsErrorPlaceho
George Joseph
2017/04/04 23:37:41
Done.
| |
| 58 }; | 60 }; |
| 59 | 61 |
| 60 // Convenience method to set up a new WebViewPlugin using |preferences| | 62 // Convenience method to set up a new WebViewPlugin using |preferences| |
| 61 // and displaying |html_data|. |url| should be a (fake) data:text/html URL; | 63 // and displaying |html_data|. |url| should be a (fake) data:text/html URL; |
| 62 // it is only used for navigation and never actually resolved. | 64 // it is only used for navigation and never actually resolved. |
| 63 static WebViewPlugin* Create(content::RenderView* render_view, | 65 static WebViewPlugin* Create(content::RenderView* render_view, |
| 64 Delegate* delegate, | 66 Delegate* delegate, |
| 65 const content::WebPreferences& preferences, | 67 const content::WebPreferences& preferences, |
| 66 const std::string& html_data, | 68 const std::string& html_data, |
| 67 const GURL& url); | 69 const GURL& url); |
| 68 | 70 |
| 69 blink::WebView* web_view() { return web_view_helper_.web_view(); } | 71 blink::WebView* web_view() { return web_view_helper_.web_view(); } |
| 70 | 72 |
| 71 const blink::WebString& old_title() const { return old_title_; } | 73 const blink::WebString& old_title() const { return old_title_; } |
| 72 | 74 |
| 73 // When loading a plugin document (i.e. a full page plugin not embedded in | 75 // When loading a plugin document (i.e. a full page plugin not embedded in |
| 74 // another page), we save all data that has been received, and replay it with | 76 // another page), we save all data that has been received, and replay it with |
| 75 // this method on the actual plugin. | 77 // this method on the actual plugin. |
| 76 void ReplayReceivedData(blink::WebPlugin* plugin); | 78 void ReplayReceivedData(blink::WebPlugin* plugin); |
| 77 | 79 |
| 78 // WebPlugin methods: | 80 // WebPlugin methods: |
| 79 blink::WebPluginContainer* container() const override; | 81 blink::WebPluginContainer* container() const override; |
| 80 // The WebViewPlugin, by design, never fails to initialize. It's used to | 82 // The WebViewPlugin, by design, never fails to initialize. It's used to |
| 81 // display placeholders and error messages, so it must never fail. | 83 // display placeholders and error messages, so it must never fail. |
| 82 bool initialize(blink::WebPluginContainer*) override; | 84 bool initialize(blink::WebPluginContainer*) override; |
| 83 void destroy() override; | 85 void destroy() override; |
| 84 | 86 |
| 85 v8::Local<v8::Object> v8ScriptableObject(v8::Isolate* isolate) override; | 87 v8::Local<v8::Object> v8ScriptableObject(v8::Isolate* isolate) override; |
| 86 | 88 |
| 89 bool isErrorplaceholder() override; | |
|
tommycli
2017/04/03 22:15:49
and isErrorPlaceholder here
George Joseph
2017/04/04 23:37:41
Done.
| |
| 90 | |
| 87 void updateAllLifecyclePhases() override; | 91 void updateAllLifecyclePhases() override; |
| 88 void paint(blink::WebCanvas* canvas, const blink::WebRect& rect) override; | 92 void paint(blink::WebCanvas* canvas, const blink::WebRect& rect) override; |
| 89 | 93 |
| 90 // Coordinates are relative to the containing window. | 94 // Coordinates are relative to the containing window. |
| 91 void updateGeometry(const blink::WebRect& window_rect, | 95 void updateGeometry(const blink::WebRect& window_rect, |
| 92 const blink::WebRect& clip_rect, | 96 const blink::WebRect& clip_rect, |
| 93 const blink::WebRect& unobscured_rect, | 97 const blink::WebRect& unobscured_rect, |
| 94 const blink::WebVector<blink::WebRect>& cut_outs_rects, | 98 const blink::WebVector<blink::WebRect>& cut_outs_rects, |
| 95 bool is_visible) override; | 99 bool is_visible) override; |
| 96 | 100 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 176 // Owned by us, deleted via |close()|. | 180 // Owned by us, deleted via |close()|. |
| 177 blink::WebView* web_view_; | 181 blink::WebView* web_view_; |
| 178 }; | 182 }; |
| 179 WebViewHelper web_view_helper_; | 183 WebViewHelper web_view_helper_; |
| 180 | 184 |
| 181 // Should be invalidated when destroy() is called. | 185 // Should be invalidated when destroy() is called. |
| 182 base::WeakPtrFactory<WebViewPlugin> weak_factory_; | 186 base::WeakPtrFactory<WebViewPlugin> weak_factory_; |
| 183 }; | 187 }; |
| 184 | 188 |
| 185 #endif // COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_ | 189 #endif // COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_ |
| OLD | NEW |