OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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. |
| 4 |
| 5 #include "chrome/browser/media/protected_media_identifier_whitelist.h" |
| 6 |
| 7 #include "base/command_line.h" |
| 8 #include "base/strings/string_split.h" |
| 9 #include "chrome/common/chrome_switches.h" |
| 10 #include "media/base/media_switches.h" |
| 11 |
| 12 ProtectedMediaIdentifierWhitelist::ProtectedMediaIdentifierWhitelist() {} |
| 13 |
| 14 ProtectedMediaIdentifierWhitelist::~ProtectedMediaIdentifierWhitelist() {} |
| 15 |
| 16 ContentSetting ProtectedMediaIdentifierWhitelist::modifySettingFor( |
| 17 ContentSetting original, |
| 18 const GURL& requesting_origin) const { |
| 19 if (original != CONTENT_SETTING_ASK) { |
| 20 return original; |
| 21 } |
| 22 |
| 23 const base::CommandLine& command_line = |
| 24 *base::CommandLine::ForCurrentProcess(); |
| 25 |
| 26 if (command_line.HasSwitch(switches::kUserDataDir) && |
| 27 command_line.HasSwitch( |
| 28 switches::kDisableInfobarForProtectedMediaIdentifierForDomain)) { |
| 29 std::string whitelist = command_line.GetSwitchValueASCII( |
| 30 switches::kDisableInfobarForProtectedMediaIdentifierForDomain); |
| 31 for (const std::string& origin : |
| 32 base::SplitString(whitelist, ",", base::TRIM_WHITESPACE, |
| 33 base::SPLIT_WANT_NONEMPTY)) { |
| 34 if (requesting_origin.DomainIs(origin)) { |
| 35 return CONTENT_SETTING_ALLOW; |
| 36 } |
| 37 } |
| 38 } |
| 39 |
| 40 return original; |
| 41 } |
OLD | NEW |