| 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..7ebccc4b431fea7bd01280501ba3fe8a80a21c5b 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
|
| + // 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;
|
| @@ -176,6 +185,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
|
| @@ -245,6 +259,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 +275,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);
|
| + // 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);
|
| +
|
| + // 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.
|
| + 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 +325,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);
|
| @@ -328,6 +374,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.
|
| @@ -350,6 +405,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);
|
| };
|
|
|
|
|