Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / media / filters / default_media_permission.cc
blob80d7093f71d2250774819cd1fe80120b0e904329
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "media/filters/default_media_permission.h"
7 #include "base/bind.h"
8 #include "base/location.h"
9 #include "base/logging.h"
10 #include "base/message_loop/message_loop_proxy.h"
12 namespace media {
14 DefaultMediaPermission::DefaultMediaPermission(bool allow) : allow_(allow) {
17 DefaultMediaPermission::~DefaultMediaPermission() {
20 static void FirePermissionStatusCallback(
21 const MediaPermission::PermissionStatusCB& permission_status_cb,
22 bool allow) {
23 LOG(WARNING) << (allow ? "Allowing" : "Denying")
24 << "media permission request with a default value instead of "
25 "real user's consent. This should NOT be used for in a real "
26 "user-facing product.";
27 // Return the callback asynchronously.
28 base::MessageLoopProxy::current()->PostTask(
29 FROM_HERE, base::Bind(permission_status_cb, allow));
32 void DefaultMediaPermission::HasPermission(
33 Type type,
34 const GURL& /* security_origin */,
35 const PermissionStatusCB& permission_status_cb) {
36 CHECK_EQ(PROTECTED_MEDIA_IDENTIFIER, type);
37 FirePermissionStatusCallback(permission_status_cb, allow_);
40 void DefaultMediaPermission::RequestPermission(
41 Type type,
42 const GURL& /* security_origin */,
43 const PermissionStatusCB& permission_status_cb) {
44 CHECK_EQ(PROTECTED_MEDIA_IDENTIFIER, type);
45 FirePermissionStatusCallback(permission_status_cb, allow_);
48 } // namespace media