[AndroidWebViewShell] Replace rebaseline script with a new version using test_runner.py
[chromium-blink-merge.git] / media / filters / default_media_permission.cc
blob60623b9a781d6f5aa031cbb7453ba094aec1c35a
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/single_thread_task_runner.h"
11 #include "base/thread_task_runner_handle.h"
13 namespace media {
15 DefaultMediaPermission::DefaultMediaPermission(bool allow) : allow_(allow) {
18 DefaultMediaPermission::~DefaultMediaPermission() {
21 static void FirePermissionStatusCallback(
22 const MediaPermission::PermissionStatusCB& permission_status_cb,
23 bool allow) {
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(
34 Type type,
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(
42 Type type,
43 const GURL& /* security_origin */,
44 const PermissionStatusCB& permission_status_cb) {
45 CHECK_EQ(PROTECTED_MEDIA_IDENTIFIER, type);
46 FirePermissionStatusCallback(permission_status_cb, allow_);
49 } // namespace media