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

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: Sync and reup patch for review. 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 b63d7351021a2e63db8f4d6eea3acae9f8c50293..7719e3cfc8d4305db173574119c1239b351a2e4f 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)
@@ -54,8 +54,10 @@ const char kEventLoadRedirect[] = "loadredirect";
const char kEventLoadStart[] = "loadstart";
const char kEventLoadStop[] = "loadstop";
const char kEventSizeChanged[] = "sizechanged";
+const char kEventRequestPermission[] = "permissionrequest";
Charlie Reis 2012/11/20 01:54:00 nit: Alphabetize
lazyboy 2012/11/20 02:55:20 Ah bad merge, Done.
// Parameters/properties on events.
+const char kInstanceIdKey[] = "instance_id";
const char kIsTopLevel[] = "isTopLevel";
const char kNewURL[] = "newUrl";
const char kNewHeight[] = "newHeight";
@@ -64,10 +66,12 @@ 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 kSrc[] = "src";
const char kReason[] = "reason";
+const char kRequestIdKey[] = "request_id";
Charlie Reis 2012/11/20 01:54:00 What's the difference between having a "Key" suffi
lazyboy 2012/11/20 02:55:20 yes that's confusing, all string in this section a
+const char kSrc[] = "src";
const char kURL[] = "url";
// Error messages.
@@ -607,6 +611,13 @@ void BrowserPlugin::LoadAbort(const GURL& url,
TriggerEvent(kEventLoadAbort, &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(kEventRequestPermission, &props);
+}
+
void BrowserPlugin::LoadRedirect(const GURL& old_url,
const GURL& new_url,
bool is_top_level) {
@@ -657,6 +668,14 @@ void BrowserPlugin::SetAcceptTouchEvents(bool accept) {
container()->setIsAcceptingTouchEvents(accept);
}
+void BrowserPlugin::RespondMediaAccess(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