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 17dcdcf5b3b340dfa0b6c0d243371883e2b3d219..a1906b603ff9be60540a1929b4c53e0865f5e2b8 100644 |
| --- a/content/renderer/browser_plugin/browser_plugin.h |
| +++ b/content/renderer/browser_plugin/browser_plugin.h |
| @@ -118,6 +118,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 |
| + // 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 |
| @@ -126,6 +132,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; |
| @@ -174,6 +183,11 @@ class CONTENT_EXPORT BrowserPlugin : |
| // For unit/integration tests. |
| friend class MockBrowserPlugin; |
| + enum PermissionRequestType { |
| + INVALID = -1, |
| + MEDIA |
| + }; |
| + |
| // A BrowserPlugin object is a controller that represents an instance of a |
| // browser plugin within the embedder renderer process. Each BrowserPlugin |
| // within a process has a unique instance_id that is used to route messages |
| @@ -243,6 +257,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( |
| @@ -257,6 +273,25 @@ 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); |
| + // Informs the BrowserPlugin that the guest's permission request has been |
| + // allowed or denied by the embedder. |
| + void AllowPermission(PermissionRequestType type, |
| + int request_id, |
| + bool allow); |
| + |
| + void AllowPermissionIfRequestIsPending(int request_id, bool allow); |
|
Charlie Reis
2013/02/13 21:08:05
Please add comments for these three.
lazyboy
2013/02/13 22:17:34
Done.
|
| + void OnRequestObjectGarbageCollected(int request_id); |
| + 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); |
| @@ -282,6 +317,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, |
| + const std::string& 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); |
| @@ -326,6 +366,15 @@ class CONTENT_EXPORT BrowserPlugin : |
| bool size_changed_in_flight_; |
| bool allocate_instance_id_sent_; |
| + typedef std::map<int, std::pair<int, PermissionRequestType> > |
| + 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. |
| @@ -348,6 +397,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_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); |
| }; |