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/single_thread_task_runner.h"
11 #include "base/thread_task_runner_handle.h"
15 DefaultMediaPermission::DefaultMediaPermission(bool allow
) : allow_(allow
) {
18 DefaultMediaPermission::~DefaultMediaPermission() {
21 static void FirePermissionStatusCallback(
22 const MediaPermission::PermissionStatusCB
& permission_status_cb
,
24 LOG(WARNING
) << (allow
? "Allowing" : "Denying")
25 << "media permission request with a default value instead of "
26 "real user's consent. This should NOT be used for in a real "
27 "user-facing product.";
28 // Return the callback asynchronously.
29 base::ThreadTaskRunnerHandle::Get()->PostTask(
30 FROM_HERE
, base::Bind(permission_status_cb
, allow
));
33 void DefaultMediaPermission::HasPermission(
35 const GURL
& /* security_origin */,
36 const PermissionStatusCB
& permission_status_cb
) {
37 CHECK_EQ(PROTECTED_MEDIA_IDENTIFIER
, type
);
38 FirePermissionStatusCallback(permission_status_cb
, allow_
);
41 void DefaultMediaPermission::RequestPermission(
43 const GURL
& /* security_origin */,
44 const PermissionStatusCB
& permission_status_cb
) {
45 CHECK_EQ(PROTECTED_MEDIA_IDENTIFIER
, type
);
46 FirePermissionStatusCallback(permission_status_cb
, allow_
);