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> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
11 #include "chrome/common/chrome_switches.h" | 11 #include "chrome/common/chrome_switches.h" |
12 | 12 |
13 void GetSecureOriginWhitelist(std::set<GURL>* origins) { | 13 void GetSecureOriginWhitelist(std::set<GURL>* origins) { |
14 // If kUnsafetyTreatInsecureOriginAsSecure option is given and | 14 // If kUnsafelyTreatInsecureOriginAsSecure option is given and |
15 // kUserDataDir is present, add the given origins as trustworthy | 15 // kUserDataDir is present, add the given origins as trustworthy |
16 // for whitelisting. | 16 // for whitelisting. |
17 const base::CommandLine& command_line = | 17 const base::CommandLine& command_line = |
18 *base::CommandLine::ForCurrentProcess(); | 18 *base::CommandLine::ForCurrentProcess(); |
19 if (command_line.HasSwitch(switches::kUnsafetyTreatInsecureOriginAsSecure) && | 19 if (command_line.HasSwitch(switches::kUnsafelyTreatInsecureOriginAsSecure) && |
20 command_line.HasSwitch(switches::kUserDataDir)) { | 20 command_line.HasSwitch(switches::kUserDataDir)) { |
21 std::vector<std::string> given_origins; | 21 std::vector<std::string> given_origins; |
22 base::SplitString(command_line.GetSwitchValueASCII( | 22 base::SplitString(command_line.GetSwitchValueASCII( |
23 switches::kUnsafetyTreatInsecureOriginAsSecure), ',', &given_origins); | 23 switches::kUnsafelyTreatInsecureOriginAsSecure), ',', &given_origins); |
24 for (const auto& origin : given_origins) | 24 for (const auto& origin : given_origins) |
25 origins->insert(GURL(origin)); | 25 origins->insert(GURL(origin)); |
26 } | 26 } |
27 } | 27 } |
OLD | NEW |