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

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

Issue 1124343002: Plugin Power Saver: Enable JS access to throttled plugins. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months 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
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"
(...skipping 30 matching lines...) Expand all
41 // Bind |frame| to a Javascript object, enabling the delegate to receive 41 // Bind |frame| to a Javascript object, enabling the delegate to receive
42 // callback methods from Javascript inside the WebFrame. 42 // callback methods from Javascript inside the WebFrame.
43 // This method is called from WebFrameClient::didClearWindowObject. 43 // This method is called from WebFrameClient::didClearWindowObject.
44 virtual void BindWebFrame(blink::WebFrame* frame) = 0; 44 virtual void BindWebFrame(blink::WebFrame* frame) = 0;
45 45
46 // Called upon a context menu event. 46 // Called upon a context menu event.
47 virtual void ShowContextMenu(const blink::WebMouseEvent&) = 0; 47 virtual void ShowContextMenu(const blink::WebMouseEvent&) = 0;
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
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.
54 virtual v8::Local<v8::Object> GetV8ScriptableObject(v8::Isolate*) const = 0;
51 }; 55 };
52 56
53 // Convenience method to set up a new WebViewPlugin using |preferences| 57 // Convenience method to set up a new WebViewPlugin using |preferences|
54 // and displaying |html_data|. |url| should be a (fake) data:text/html URL; 58 // and displaying |html_data|. |url| should be a (fake) data:text/html URL;
55 // it is only used for navigation and never actually resolved. 59 // it is only used for navigation and never actually resolved.
56 static WebViewPlugin* Create(Delegate* delegate, 60 static WebViewPlugin* Create(Delegate* delegate,
57 const content::WebPreferences& preferences, 61 const content::WebPreferences& preferences,
58 const std::string& html_data, 62 const std::string& html_data,
59 const GURL& url); 63 const GURL& url);
60 64
61 blink::WebView* web_view() { return web_view_; } 65 blink::WebView* web_view() { return web_view_; }
62 66
63 // When loading a plugin document (i.e. a full page plugin not embedded in 67 // When loading a plugin document (i.e. a full page plugin not embedded in
64 // another page), we save all data that has been received, and replay it with 68 // another page), we save all data that has been received, and replay it with
65 // this method on the actual plugin. 69 // this method on the actual plugin.
66 void ReplayReceivedData(blink::WebPlugin* plugin); 70 void ReplayReceivedData(blink::WebPlugin* plugin);
67 71
68 void RestoreTitleText(); 72 void RestoreTitleText();
69 73
70 // WebPlugin methods: 74 // WebPlugin methods:
71 virtual blink::WebPluginContainer* container() const; 75 virtual blink::WebPluginContainer* container() const;
72 virtual bool initialize(blink::WebPluginContainer*); 76 virtual bool initialize(blink::WebPluginContainer*);
73 virtual void destroy(); 77 virtual void destroy();
74 78
75 virtual NPObject* scriptableObject(); 79 virtual v8::Local<v8::Object> v8ScriptableObject(v8::Isolate* isolate);
76 virtual struct _NPP* pluginNPP();
77
78 virtual bool getFormValue(blink::WebString& value);
79 80
80 virtual void layoutIfNeeded() override; 81 virtual void layoutIfNeeded() override;
81 virtual void paint(blink::WebCanvas* canvas, 82 virtual void paint(blink::WebCanvas* canvas,
82 const blink::WebRect& rect) override; 83 const blink::WebRect& rect) override;
83 84
84 // Coordinates are relative to the containing window. 85 // Coordinates are relative to the containing window.
85 virtual void updateGeometry( 86 virtual void updateGeometry(
86 const blink::WebRect& window_rect, 87 const blink::WebRect& window_rect,
87 const blink::WebRect& clip_rect, 88 const blink::WebRect& clip_rect,
88 const blink::WebRect& unobscured_rect, 89 const blink::WebRect& unobscured_rect,
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 163
163 blink::WebURLResponse response_; 164 blink::WebURLResponse response_;
164 std::list<std::string> data_; 165 std::list<std::string> data_;
165 bool finished_loading_; 166 bool finished_loading_;
166 scoped_ptr<blink::WebURLError> error_; 167 scoped_ptr<blink::WebURLError> error_;
167 blink::WebString old_title_; 168 blink::WebString old_title_;
168 bool focused_; 169 bool focused_;
169 }; 170 };
170 171
171 #endif // COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_ 172 #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