Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: chrome/browser/io_thread.cc

Issue 2753123002: Add --ignore-certificate-errors-spki-list switch and UMA histogram. (Closed)
Patch Set: Add --ignore-certificate-errors-spki-list switch and UMA histogram. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/io_thread_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/browser/io_thread.h" 5 #include "chrome/browser/io_thread.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 if (!quic_origin.IsEmpty()) 1017 if (!quic_origin.IsEmpty())
1018 params->origins_to_force_quic_on.insert(quic_origin); 1018 params->origins_to_force_quic_on.insert(quic_origin);
1019 } 1019 }
1020 } 1020 }
1021 } 1021 }
1022 1022
1023 // Parameters only controlled by command line. 1023 // Parameters only controlled by command line.
1024 if (command_line.HasSwitch(switches::kEnableUserAlternateProtocolPorts)) { 1024 if (command_line.HasSwitch(switches::kEnableUserAlternateProtocolPorts)) {
1025 params->enable_user_alternate_protocol_ports = true; 1025 params->enable_user_alternate_protocol_ports = true;
1026 } 1026 }
1027 if (command_line.HasSwitch(switches::kIgnoreCertificateErrorsSPKIList)) {
1028 std::string spki_list = command_line.GetSwitchValueASCII(
1029 switches::kIgnoreCertificateErrorsSPKIList);
1030 for (const std::string& spki : base::SplitString(
1031 spki_list, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) {
1032 net::HashValue hash;
1033 if (!hash.FromString("sha256/" + spki)) {
1034 LOG(ERROR) << "Invalid SPKI in --ignore-certificate-errors-spki-list: "
1035 << spki;
1036 } else {
1037 net::SHA256HashValue hv;
1038 DCHECK_EQ(hash.size(), sizeof(hv));
1039 memcpy(&hv, hash.data(), sizeof(hv));
1040 params->ignore_certificate_error_spki_set.insert(hv);
1041 }
1042 }
1043 }
Ryan Sleevi 2017/03/30 15:12:09 So a thought - if we didn't want to plumb the SPKI
martinkr 2017/03/30 17:33:38 Yeah, I think it would also be easier to understan
1044 UMA_HISTOGRAM_BOOLEAN(
1045 "Net.Certificate.kIgnoreCertificateErrorsSPKIList",
1046 command_line.HasSwitch(switches::kIgnoreCertificateErrorsSPKIList));
1027 if (command_line.HasSwitch(switches::kIgnoreCertificateErrors)) { 1047 if (command_line.HasSwitch(switches::kIgnoreCertificateErrors)) {
1028 params->ignore_certificate_errors = true; 1048 params->ignore_certificate_errors = true;
1029 } 1049 }
1030 UMA_HISTOGRAM_BOOLEAN( 1050 UMA_HISTOGRAM_BOOLEAN(
1031 "Net.Certificate.IgnoreErrors", 1051 "Net.Certificate.IgnoreErrors",
1032 command_line.HasSwitch(switches::kIgnoreCertificateErrors)); 1052 command_line.HasSwitch(switches::kIgnoreCertificateErrors));
1033 if (command_line.HasSwitch(switches::kTestingFixedHttpPort)) { 1053 if (command_line.HasSwitch(switches::kTestingFixedHttpPort)) {
1034 params->testing_fixed_http_port = 1054 params->testing_fixed_http_port =
1035 GetSwitchValueAsInt(command_line, switches::kTestingFixedHttpPort); 1055 GetSwitchValueAsInt(command_line, switches::kTestingFixedHttpPort);
1036 } 1056 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1112 1132
1113 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the 1133 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the
1114 // system URLRequestContext too. There's no reason this should be tied to a 1134 // system URLRequestContext too. There's no reason this should be tied to a
1115 // profile. 1135 // profile.
1116 return context; 1136 return context;
1117 } 1137 }
1118 1138
1119 metrics::UpdateUsagePrefCallbackType IOThread::GetMetricsDataUseForwarder() { 1139 metrics::UpdateUsagePrefCallbackType IOThread::GetMetricsDataUseForwarder() {
1120 return base::Bind(&UpdateMetricsUsagePrefsOnUIThread); 1140 return base::Bind(&UpdateMetricsUsagePrefsOnUIThread);
1121 } 1141 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/io_thread_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698