Chromium Code Reviews| 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/browser/net/chrome_net_log_helper.h" |
| 6 | |
| 7 #include <vector> | |
| 8 | 6 |
| 9 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 10 #include "base/strings/string_split.h" | 8 #include "base/logging.h" |
| 11 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
| 12 | 10 |
| 13 void GetSecureOriginWhitelist(std::set<GURL>* origins) { | 11 net::NetLogCaptureMode GetNetCaptureMode() { |
| 14 // If kUnsafelyTreatInsecureOriginAsSecure option is given and | |
| 15 // kUserDataDir is present, add the given origins as trustworthy | |
| 16 // for whitelisting. | |
| 17 const base::CommandLine& command_line = | 12 const base::CommandLine& command_line = |
| 18 *base::CommandLine::ForCurrentProcess(); | 13 *base::CommandLine::ForCurrentProcess(); |
|
eroman
2015/09/16 20:52:21
Can you make this an input parameter to the functi
droger
2015/09/17 08:39:10
Done.
| |
| 19 if (command_line.HasSwitch(switches::kUnsafelyTreatInsecureOriginAsSecure) && | 14 |
| 20 command_line.HasSwitch(switches::kUserDataDir)) { | 15 if (command_line.HasSwitch(switches::kNetLogCaptureMode)) { |
| 21 std::string origins_str = command_line.GetSwitchValueASCII( | 16 std::string capture_mode_string = |
| 22 switches::kUnsafelyTreatInsecureOriginAsSecure); | 17 command_line.GetSwitchValueASCII(switches::kNetLogCaptureMode); |
| 23 for (const std::string& origin : base::SplitString( | 18 if (capture_mode_string == "Default") |
| 24 origins_str, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) | 19 return net::NetLogCaptureMode::Default(); |
| 25 origins->insert(GURL(origin)); | 20 if (capture_mode_string == "IncludeCookiesAndCredentials") |
| 21 return net::NetLogCaptureMode::IncludeCookiesAndCredentials(); | |
| 22 if (capture_mode_string == "IncludeSocketBytes") | |
| 23 return net::NetLogCaptureMode::IncludeSocketBytes(); | |
| 24 | |
| 25 LOG(ERROR) << "Unrecognized value for --" << switches::kNetLogCaptureMode; | |
| 26 } | 26 } |
| 27 | |
| 28 return net::NetLogCaptureMode::Default(); | |
| 27 } | 29 } |
| OLD | NEW |