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

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: 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/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 0971b85042d3ddf0e02b4bf542398285d4010c31..85851477571dde25d7f3b833eb56c125b88321df 100644
--- a/content/renderer/browser_plugin/browser_plugin.cc
+++ b/content/renderer/browser_plugin/browser_plugin.cc
@@ -26,8 +26,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)
@@ -59,8 +59,11 @@ const char kOldURL[] = "oldUrl";
const char kOldHeight[] = "oldHeight";
const char kOldWidth[] = "oldWidth";
const char kPartitionAttribute[] = "partition";
+const char kPermissionRequestEventName[] = "permissionrequest";
sadrul 2012/11/16 03:59:53 General comment (definitely not scope for this CL)
lazyboy 2012/11/16 06:27:09 Agreed, I'll fix that separately so I don't have t
+const char kPermissionTypeMedia[] = "media";
const char kPersistPrefix[] = "persist:";
const char kProcessId[] = "processId";
+const char kRequestIdKey[] = "request_id";
const char kSizeChangedEventName[] = "sizechanged";
const char kSrcAttribute[] = "src";
const char kReason[] = "reason";
@@ -587,6 +590,13 @@ void BrowserPlugin::LoadAbort(const GURL& url,
TriggerEvent(kLoadAbortEventName, &props);
}
+void BrowserPlugin::RequestMediaAccess(int request_id) {
+ std::map<std::string, base::Value*> props;
+ props[kReason] = base::Value::CreateStringValue(kPermissionTypeMedia);
+ props[kRequestIdKey] = base::Value::CreateIntegerValue(request_id);
+ TriggerEvent(kPermissionRequestEventName, &props);
+}
+
void BrowserPlugin::LoadRedirect(const GURL& old_url,
const GURL& new_url,
bool is_top_level) {
@@ -637,6 +647,14 @@ void BrowserPlugin::SetAcceptTouchEvents(bool accept) {
container()->setIsAcceptingTouchEvents(accept);
}
+void BrowserPlugin::AllowMediaAccess(int request_id, bool allow) {
+ BrowserPluginManager::Get()->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