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

Unified Diff: components/cronet/url_request_context_config.cc

Issue 1407263010: [Cronet] Public key pinning for Java API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Hostname validation using IDN.USE_STD3_ASCII_RULES and conflict resolution Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: components/cronet/url_request_context_config.cc
diff --git a/components/cronet/url_request_context_config.cc b/components/cronet/url_request_context_config.cc
index 5cd24b8664120160a03325b4288a9fd4b1c68752..0415a37bbf236552058b7aa8293e7ab7bc900710 100644
--- a/components/cronet/url_request_context_config.cc
+++ b/components/cronet/url_request_context_config.cc
@@ -70,6 +70,15 @@ void ParseAndSetExperimentalOptions(
}
}
+bool GetTimeFromDouble(const base::Value* json_value, base::Time* time) {
+ double time_double;
+ bool success = json_value->GetAsDouble(&time_double);
+ if (success) {
+ *time = base::Time::FromDoubleT(time_double);
+ }
+ return success;
+}
+
} // namespace
#define DEFINE_CONTEXT_CONFIG(x) const char REQUEST_CONTEXT_CONFIG_##x[] = #x;
@@ -95,6 +104,21 @@ void URLRequestContextConfig::QuicHint::RegisterJSONConverter(
&URLRequestContextConfig::QuicHint::alternate_port);
}
+// static
+void URLRequestContextConfig::Pkp::RegisterJSONConverter(
+ base::JSONValueConverter<URLRequestContextConfig::Pkp>* converter) {
+ converter->RegisterStringField(REQUEST_CONTEXT_CONFIG_PKP_HOST,
+ &URLRequestContextConfig::Pkp::host);
+ converter->RegisterRepeatedString(REQUEST_CONTEXT_CONFIG_PKP_PIN_HASHES,
+ &URLRequestContextConfig::Pkp::pin_hashes);
+ converter->RegisterBoolField(
+ REQUEST_CONTEXT_CONFIG_PKP_INCLUDE_SUBDOMAINS,
+ &URLRequestContextConfig::Pkp::include_subdomains);
+ converter->RegisterCustomValueField<base::Time>(
+ REQUEST_CONTEXT_CONFIG_PKP_EXPIRATION_DATE,
+ &URLRequestContextConfig::Pkp::expiration_date, &GetTimeFromDouble);
+}
+
URLRequestContextConfig::URLRequestContextConfig() {}
URLRequestContextConfig::~URLRequestContextConfig() {}
@@ -179,6 +203,8 @@ void URLRequestContextConfig::RegisterJSONConverter(
converter->RegisterStringField(
REQUEST_CONTEXT_CONFIG_DATA_REDUCTION_PROXY_KEY,
&URLRequestContextConfig::data_reduction_proxy_key);
+ converter->RegisterRepeatedMessage(REQUEST_CONTEXT_CONFIG_PKP_LIST,
+ &URLRequestContextConfig::pkp_list);
// For Testing.
converter->RegisterCustomField<scoped_ptr<net::CertVerifier>>(

Powered by Google App Engine
This is Rietveld 408576698