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"
8 #include "base/location.h"
9 #include "base/logging.h"
10 #include "base/message_loop/message_loop_proxy.h"
14 DefaultMediaPermission::DefaultMediaPermission(bool allow
) : allow_(allow
) {
17 DefaultMediaPermission::~DefaultMediaPermission() {
20 static void FirePermissionStatusCallback(
21 const MediaPermission::PermissionStatusCB
& permission_status_cb
,
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(
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(
42 const GURL
& /* security_origin */,
43 const PermissionStatusCB
& permission_status_cb
) {
44 CHECK_EQ(PROTECTED_MEDIA_IDENTIFIER
, type
);
45 FirePermissionStatusCallback(permission_status_cb
, allow_
);