Chromium Code Reviews| Index: content/renderer/browser_plugin/browser_plugin.h |
| diff --git a/content/renderer/browser_plugin/browser_plugin.h b/content/renderer/browser_plugin/browser_plugin.h |
| index 3e63f1179496355fd8433c0fee9b282653eb6214..d7260c168386c6f92c28cf6e4a42fb114e79541a 100644 |
| --- a/content/renderer/browser_plugin/browser_plugin.h |
| +++ b/content/renderer/browser_plugin/browser_plugin.h |
| @@ -120,6 +120,12 @@ class CONTENT_EXPORT BrowserPlugin : |
| void Reload(); |
| // A request to enable hardware compositing. |
| void EnableCompositing(bool enable); |
| + // A request from content client to track lifetime of a Javascript object |
|
abarth-chromium
2013/02/20 20:46:44
Javascript -> JavaScript
lazyboy
2013/02/20 22:09:36
Done.
|
| + // related to a permission request object. |
| + // This is used to clean up hanging permission request objects. |
| + void PersistRequestObject(const NPVariant* request, |
| + const std::string& type, |
| + int id); |
| // Returns true if |point| lies within the bounds of the plugin rectangle. |
| // Not OK to use this function for making security-sensitive decision since it |
| @@ -128,6 +134,9 @@ class CONTENT_EXPORT BrowserPlugin : |
| bool InBounds(const gfx::Point& point) const; |
| gfx::Point ToLocalCoordinates(const gfx::Point& point) const; |
| + // Called by browser plugin binding. |
| + void OnEmbedderDecidedPermission(int request_id, bool allow); |
| + |
| // WebKit::WebPlugin implementation. |
| virtual WebKit::WebPluginContainer* container() const OVERRIDE; |
| @@ -245,6 +254,8 @@ class CONTENT_EXPORT BrowserPlugin : |
| // Informs the BrowserPlugin that guest has changed its size in autosize mode. |
| void SizeChangedDueToAutoSize(const gfx::Size& old_view_size); |
| + bool HasEventListeners(const std::string& event_name); |
| + |
| // Indicates whether a damage buffer was used by the guest process for the |
| // provided |params|. |
| static bool UsesDamageBuffer( |
| @@ -259,6 +270,31 @@ class CONTENT_EXPORT BrowserPlugin : |
| // browser process. |
| void SetInstanceID(int instance_id); |
| + // Populates the ancestor set with the ancestors of the BrowserPlugin. A new |
| + // BrowserPlugin gets created when we reparent the <object> node, so this |
| + // set should always be valid. |
| + void PopulateAncestorList(); |
| + |
| + // Requests media access permission from the embedder. |
| + void RequestMediaPermission(int request_id, |
| + const base::DictionaryValue& request_info); |
|
abarth-chromium
2013/02/20 20:46:44
bad indent
lazyboy
2013/02/20 22:09:36
Done.
|
| + // Informs the BrowserPlugin that the guest's permission request has been |
| + // allowed or denied by the embedder. |
| + void AllowPermission(BrowserPluginPermissionType permission_type, |
| + int request_id, |
| + bool allow); |
| + |
| + // If the request with id |request_id| is pending then informs the |
| + // BrowserPlugin that the guest's permission request has been allowed or |
| + // denied by the embedder. |
| + void AllowPermissionIfRequestIsPending(int request_id, bool allow); |
| + // Cleans up pending permission request once the associated event.request |
| + // object goes out of scope in Javascript. |
|
abarth-chromium
2013/02/20 20:46:44
Javascript -> JavaScript.
lazyboy
2013/02/20 22:09:36
Done.
|
| + void OnRequestObjectGarbageCollected(int request_id); |
| + // V8 garbage collection callback for |object|. |
| + static void WeakCallbackForPersistObject(v8::Persistent<v8::Value> object, |
| + void* param); |
| + |
| // IPC message handlers. |
| // Please keep in alphabetical order. |
| void OnAdvanceFocus(int instance_id, bool reverse); |
| @@ -284,6 +320,11 @@ class CONTENT_EXPORT BrowserPlugin : |
| bool is_top_level); |
| void OnLoadStart(int instance_id, const GURL& url, bool is_top_level); |
| void OnLoadStop(int instance_id); |
| + // Requests permission from the embedder. |
| + void OnRequestPermission(int instance_id, |
| + BrowserPluginPermissionType permission_type, |
| + int request_id, |
| + const base::DictionaryValue& request_info); |
| void OnSetCursor(int instance_id, const WebCursor& cursor); |
| void OnShouldAcceptTouchEvents(int instance_id, bool accept); |
| void OnUpdatedName(int instance_id, const std::string& name); |
| @@ -328,6 +369,17 @@ class CONTENT_EXPORT BrowserPlugin : |
| bool size_changed_in_flight_; |
| bool allocate_instance_id_sent_; |
| + // Each permission request item in the map is a pair of request id and |
| + // permission type (BrowserPluginPermissionType). |
| + typedef std::map<int, std::pair<int, int> > |
| + PendingPermissionRequests; |
| + PendingPermissionRequests pending_permission_requests_; |
| + |
| + typedef std::pair<int, base::WeakPtr<BrowserPlugin> > |
| + AliveV8PermissionRequestItem; |
| + std::map<int, AliveV8PermissionRequestItem*> |
| + alive_v8_permission_request_objects_; |
| + |
| // BrowserPlugin outlives RenderViewImpl in Chrome Apps and so we need to |
| // store the BrowserPlugin's BrowserPluginManager in a member variable to |
| // avoid accessing the RenderViewImpl. |
| @@ -350,6 +402,13 @@ class CONTENT_EXPORT BrowserPlugin : |
| bool compositing_enabled_; |
| scoped_refptr<BrowserPluginCompositingHelper> compositing_helper_; |
| + // Weak factory used in v8 |MakeWeak| callback, since the v8 callback might |
| + // get called after BrowserPlugin has been destroyed. |
| + base::WeakPtrFactory<BrowserPlugin> weak_ptr_factory_; |
| + |
| + // Set of ancestor nodes. |
| + std::vector<WebKit::WebNode> ancestors_; |
|
abarth-chromium
2013/02/20 20:46:44
Doesn't this create reference cycles? Normally it
lazyboy
2013/02/20 22:09:36
Removed ancestors_.
|
| + |
| DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); |
| }; |