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

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

Issue 11093080: <webview>: First stab at implementing media permission request for guests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add todo for auto deny when no listeners attached. Created 8 years 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.cc
diff --git a/content/renderer/browser_plugin/browser_plugin.cc b/content/renderer/browser_plugin/browser_plugin.cc
index c0e255ea54eaea7f901d2cfdba5d7b1513a4e55d..76f02435d2b817dc9fcac7512805a1ce5021c88a 100644
--- a/content/renderer/browser_plugin/browser_plugin.cc
+++ b/content/renderer/browser_plugin/browser_plugin.cc
@@ -27,8 +27,8 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h"
#include "webkit/plugins/sad_plugin.h"
#if defined (OS_WIN)
@@ -54,6 +54,7 @@ const char kEventLoadCommit[] = "loadcommit";
const char kEventLoadRedirect[] = "loadredirect";
const char kEventLoadStart[] = "loadstart";
const char kEventLoadStop[] = "loadstop";
+const char kEventRequestPermission[] = "permissionrequest";
const char kEventSizeChanged[] = "sizechanged";
// Parameters/properties on events.
@@ -65,9 +66,11 @@ const char kOldURL[] = "oldUrl";
const char kOldHeight[] = "oldHeight";
const char kOldWidth[] = "oldWidth";
const char kPartition[] = "partition";
+const char kPermissionTypeMedia[] = "media";
const char kPersistPrefix[] = "persist:";
const char kProcessId[] = "processId";
const char kReason[] = "reason";
+const char kRequestId[] = "request_id";
const char kSrc[] = "src";
const char kURL[] = "url";
@@ -664,6 +667,18 @@ void BrowserPlugin::LoadAbort(const GURL& url,
TriggerEvent(kEventLoadAbort, &props);
}
+void BrowserPlugin::RequestMediaAccess(int request_id) {
+ // TODO(lazyboy): Automatically deny the request if there are no event
+ // listeners for permissionrequest. Right now it is not possible to know about
Charlie Reis 2012/12/07 19:16:25 So what happens now if there's no listeners? Do w
lazyboy 2012/12/07 22:50:44 When there's no listeners, yes we end up with lost
+ // this info directly from the plugin because the user facing event listeners
+ // are registered on the shim, not on the plugin. Also, there is always one
+ // listener registered on the plugin from the shim.
Charlie Reis 2012/12/07 19:16:25 One permissionrequest listener? I'm not sure I fo
lazyboy 2012/12/07 22:50:44 This is the one (and only one) '-internal-permissi
+ std::map<std::string, base::Value*> props;
+ props[kReason] = base::Value::CreateStringValue(kPermissionTypeMedia);
+ props[kRequestId] = base::Value::CreateIntegerValue(request_id);
+ TriggerEvent(kEventRequestPermission, &props);
+}
+
void BrowserPlugin::LoadRedirect(const GURL& old_url,
const GURL& new_url,
bool is_top_level) {
@@ -717,6 +732,14 @@ void BrowserPlugin::SetAcceptTouchEvents(bool accept) {
}
}
+void BrowserPlugin::RespondMediaAccess(int request_id, bool allow) {
+ browser_plugin_manager()->Send(
+ new BrowserPluginHostMsg_AllowMediaAccess(render_view_->GetRoutingID(),
+ instance_id_,
+ request_id,
+ allow));
+}
+
WebKit::WebPluginContainer* BrowserPlugin::container() const {
return container_;
}

Powered by Google App Engine
This is Rietveld 408576698