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

Unified Diff: content/renderer/browser_plugin/browser_plugin.h

Issue 11093080: <webview>: First stab at implementing media permission request for guests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Plugin can be destroyed before we get Weak Callback, fixed. Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
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..68858d3bd24421421852d0ee40e407947597eb0c 100644
--- a/content/renderer/browser_plugin/browser_plugin.h
+++ b/content/renderer/browser_plugin/browser_plugin.h
@@ -118,6 +118,10 @@ class CONTENT_EXPORT BrowserPlugin :
void Reload();
// A request to enable hardware compositing.
void EnableCompositing(bool enable);
+ // A request from shim to track lifetime of a js object related to media
+ // access request object.
+ // This is used to clean up hanging media requests.
+ void PersistRequestObject(const NPVariant* request, 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 +130,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 OnListenerCallMediaAccess(int request_id, bool allow);
+
// WebKit::WebPlugin implementation.
virtual WebKit::WebPluginContainer* container() const OVERRIDE;
@@ -243,6 +250,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(
@@ -287,6 +296,18 @@ class CONTENT_EXPORT BrowserPlugin :
void OnUpdatedName(int instance_id, const std::string& name);
void OnUpdateRect(int instance_id,
const BrowserPluginMsg_UpdateRect_Params& params);
+ // Requests media access permission from the embedder.
+ void OnRequestMediaAccess(int instance_id,
+ int request_id,
+ const GURL& security_origin);
+ // Informs the BrowserPlugin that the guest's request for media access has
+ // been allowed or denied by the embedder.
+ void RespondMediaAccess(int request_id, bool allow);
+
+ void RespondMediaAccessIfPending(int request_id, bool allow);
Charlie Reis 2013/02/11 22:20:56 How does this differ from the above? Not sure wha
lazyboy 2013/02/12 05:03:45 Hmm, this checks if the request is on the pending
+ void OnMediaRequestGarbageCollected(int request_id);
+ static void WeakCallbackForPersistObject(v8::Persistent<v8::Value> object,
Charlie Reis 2013/02/11 22:20:56 How will these two generalize to other permission
lazyboy 2013/02/12 05:03:45 I'm sending type from shim, that makes it type ind
+ void* param);
int instance_id_;
base::WeakPtr<RenderViewImpl> render_view_;
@@ -325,6 +346,13 @@ class CONTENT_EXPORT BrowserPlugin :
gfx::Size last_view_size_;
bool size_changed_in_flight_;
bool allocate_instance_id_sent_;
+ typedef std::set<int> MediaAccessPendingRequestIds;
+ MediaAccessPendingRequestIds media_access_pending_request_ids_;
+
+ typedef std::pair<int, base::WeakPtr<BrowserPlugin> >
+ MediaAccessAliveV8RequestItem;
+ std::map<int, MediaAccessAliveV8RequestItem*>
+ media_access_alive_v8_request_objects_;
// BrowserPlugin outlives RenderViewImpl in Chrome Apps and so we need to
// store the BrowserPlugin's BrowserPluginManager in a member variable to
@@ -348,6 +376,8 @@ class CONTENT_EXPORT BrowserPlugin :
bool compositing_enabled_;
scoped_refptr<BrowserPluginCompositingHelper> compositing_helper_;
+ base::WeakPtrFactory<BrowserPlugin> weak_ptr_factory_;
Charlie Reis 2013/02/11 22:20:56 Perhaps include a comment saying what this is used
lazyboy 2013/02/12 05:03:45 Done.
+
DISALLOW_COPY_AND_ASSIGN(BrowserPlugin);
};

Powered by Google App Engine
This is Rietveld 408576698