| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/common/secure_origin_whitelist.h" | 5 #include "chrome/common/secure_origin_whitelist.h" |
| 6 | 6 |
| 7 #include <vector> | |
| 8 | |
| 9 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 10 #include "base/strings/string_split.h" | 8 #include "base/strings/string_split.h" |
| 11 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
| 12 #include "extensions/common/constants.h" | 10 #include "extensions/common/constants.h" |
| 13 | 11 |
| 14 void GetSecureOriginWhitelist(std::set<GURL>* origins) { | 12 void GetSecureOriginWhitelist(std::vector<std::string>* origins) { |
| 15 // If kUnsafelyTreatInsecureOriginAsSecure option is given and | 13 // If kUnsafelyTreatInsecureOriginAsSecure option is given and |
| 16 // kUserDataDir is present, add the given origins as trustworthy | 14 // kUserDataDir is present, add the given origins as trustworthy |
| 17 // for whitelisting. | 15 // for whitelisting. |
| 18 const base::CommandLine& command_line = | 16 const base::CommandLine& command_line = |
| 19 *base::CommandLine::ForCurrentProcess(); | 17 *base::CommandLine::ForCurrentProcess(); |
| 20 if (command_line.HasSwitch(switches::kUnsafelyTreatInsecureOriginAsSecure) && | 18 if (command_line.HasSwitch(switches::kUnsafelyTreatInsecureOriginAsSecure) && |
| 21 command_line.HasSwitch(switches::kUserDataDir)) { | 19 command_line.HasSwitch(switches::kUserDataDir)) { |
| 22 std::string origins_str = command_line.GetSwitchValueASCII( | 20 std::string origins_str = command_line.GetSwitchValueASCII( |
| 23 switches::kUnsafelyTreatInsecureOriginAsSecure); | 21 switches::kUnsafelyTreatInsecureOriginAsSecure); |
| 24 for (const std::string& origin : base::SplitString( | 22 for (const std::string& origin : base::SplitString( |
| 25 origins_str, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) | 23 origins_str, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) |
| 26 origins->insert(GURL(origin)); | 24 origins->push_back(origin); |
| 27 } | 25 } |
| 28 } | 26 } |
| 29 | 27 |
| 30 void GetSchemesBypassingSecureContextCheckWhitelist( | 28 void GetSchemesBypassingSecureContextCheckWhitelist( |
| 31 std::set<std::string>* schemes) { | 29 std::set<std::string>* schemes) { |
| 32 schemes->insert(extensions::kExtensionScheme); | 30 schemes->insert(extensions::kExtensionScheme); |
| 33 } | 31 } |
| OLD | NEW |