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

Unified Diff: media/filters/default_media_permission.cc

Issue 887873003: media: Add DefaultMediaPermission. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase only Created 5 years, 11 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
« no previous file with comments | « media/filters/default_media_permission.h ('k') | media/media.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/default_media_permission.cc
diff --git a/media/filters/default_media_permission.cc b/media/filters/default_media_permission.cc
new file mode 100644
index 0000000000000000000000000000000000000000..80d7093f71d2250774819cd1fe80120b0e904329
--- /dev/null
+++ b/media/filters/default_media_permission.cc
@@ -0,0 +1,48 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/filters/default_media_permission.h"
+
+#include "base/bind.h"
+#include "base/location.h"
+#include "base/logging.h"
+#include "base/message_loop/message_loop_proxy.h"
+
+namespace media {
+
+DefaultMediaPermission::DefaultMediaPermission(bool allow) : allow_(allow) {
+}
+
+DefaultMediaPermission::~DefaultMediaPermission() {
+}
+
+static void FirePermissionStatusCallback(
+ const MediaPermission::PermissionStatusCB& permission_status_cb,
+ bool allow) {
+ LOG(WARNING) << (allow ? "Allowing" : "Denying")
+ << "media permission request with a default value instead of "
+ "real user's consent. This should NOT be used for in a real "
+ "user-facing product.";
+ // Return the callback asynchronously.
+ base::MessageLoopProxy::current()->PostTask(
+ FROM_HERE, base::Bind(permission_status_cb, allow));
+}
+
+void DefaultMediaPermission::HasPermission(
+ Type type,
+ const GURL& /* security_origin */,
+ const PermissionStatusCB& permission_status_cb) {
+ CHECK_EQ(PROTECTED_MEDIA_IDENTIFIER, type);
+ FirePermissionStatusCallback(permission_status_cb, allow_);
+}
+
+void DefaultMediaPermission::RequestPermission(
+ Type type,
+ const GURL& /* security_origin */,
+ const PermissionStatusCB& permission_status_cb) {
+ CHECK_EQ(PROTECTED_MEDIA_IDENTIFIER, type);
+ FirePermissionStatusCallback(permission_status_cb, allow_);
+}
+
+} // namespace media
« no previous file with comments | « media/filters/default_media_permission.h ('k') | media/media.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698