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

Unified Diff: content/browser/browser_plugin/browser_plugin_guest.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: Use correct base for upload. Created 8 years, 2 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/browser/browser_plugin/browser_plugin_guest.h
diff --git a/content/browser/browser_plugin/browser_plugin_guest.h b/content/browser/browser_plugin/browser_plugin_guest.h
index 3c8254fa1d3e396818ff939dda40ed133e27d069..7ac8416b985a94cd590f5ff99e7e2f80a0931fb9 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.h
+++ b/content/browser/browser_plugin/browser_plugin_guest.h
@@ -53,6 +53,7 @@ namespace content {
class BrowserPluginHostFactory;
class BrowserPluginEmbedder;
class RenderProcessHost;
+struct MediaStreamRequest;
// A browser plugin guest provides functionality for WebContents to operate in
// the guest role and implements guest specific overrides for ViewHostMsg_*
@@ -119,6 +120,10 @@ class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver,
const std::string& request_method) OVERRIDE;
virtual bool HandleContextMenu(const ContextMenuParams& params) OVERRIDE;
virtual void RendererUnresponsive(WebContents* source) OVERRIDE;
+ virtual void RequestMediaAccessPermission(
+ WebContents* web_contents,
+ const content::MediaStreamRequest* request,
+ const content::MediaResponseCallback& callback) OVERRIDE;
void UpdateRect(RenderViewHost* render_view_host,
const ViewHostMsg_UpdateRect_Params& params);
@@ -166,6 +171,11 @@ class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver,
// Kill the guest process.
void Terminate();
+ // Allows or denies media access request.
+ void AllowMediaAccess(WebContents* embedder_web_contents,
+ int request_id,
+ bool allow);
+
// Overridden in tests.
virtual bool ViewTakeFocus(bool reverse);
// If possible, navigate the guest to |relative_index| entries away from the
@@ -186,6 +196,11 @@ class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver,
float scale_factor);
private:
+ typedef std::pair<content::MediaStreamRequest, content::MediaResponseCallback>
+ MediaStreamRequestAndCallbackPair;
+ typedef std::map<int, MediaStreamRequestAndCallbackPair>
+ MediaStreamRequestsMap;
+
friend class TestBrowserPluginGuest;
BrowserPluginGuest(int instance_id,
@@ -234,6 +249,11 @@ class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver,
int pending_update_counter_;
base::TimeDelta guest_hang_timeout_;
bool visible_;
+ // A map to store WebContents's media request object and callback.
+ // We need to store these because we need a roundtrip to the embedder to know
+ // if we allow or disallow the request. The key of the map is unique only for
+ // a given BrowserPluginGuest.
+ MediaStreamRequestsMap media_requests_map_;
DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest);
};

Powered by Google App Engine
This is Rietveld 408576698