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

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: Reup patch, with new style event handling + fix tests. Created 8 years, 1 month 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 f4a36614fe69c6952d07e53f784c7094d9e6f3c9..d7a216bb8c2e040f3b129c6fd28a1fe02a3785f8 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.h
+++ b/content/browser/browser_plugin/browser_plugin_guest.h
@@ -38,8 +38,8 @@
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/browser/web_contents_observer.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebDragStatus.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebDragStatus.h"
#include "ui/gfx/rect.h"
struct BrowserPluginHostMsg_AutoSize_Params;
@@ -59,6 +59,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_*
@@ -134,6 +135,10 @@ class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver,
virtual void RunFileChooser(WebContents* web_contents,
const FileChooserParams& params) OVERRIDE;
virtual bool ShouldFocusPageAfterCrash() 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);
@@ -200,6 +205,11 @@ class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver,
// web contents.
void Resize(RenderViewHost* embedder_rvh,
const BrowserPluginHostMsg_ResizeGuest_Params& params);
+ // Allows or denies a media access request, after the embedder has had a
+ // chance to decide.
+ void AllowMediaAccess(WebContents* embedder_web_contents,
+ int request_id,
+ bool should_allow);
// Overridden in tests.
// Handles input event routed through the embedder (which is initiated in the
@@ -227,6 +237,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,
@@ -281,6 +296,14 @@ class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver,
bool auto_size_;
gfx::Size max_auto_size_;
gfx::Size min_auto_size_;
+ // A counter to generate unique request id for a media access request.
+ // We only need the ids to be unique for a given BrowserPluginGuest.
+ int current_media_access_request_id_;
+ // 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