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

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: Comments & Rebase 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 ef94d0d89ca66831f883193f1a983adfb551ba54..e766c68d05b7e5ef82ff4b8713b528f9e739f948 100644
--- a/components/cronet/url_request_context_config.cc
+++ b/components/cronet/url_request_context_config.cc
@@ -103,6 +103,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;
@@ -128,6 +137,25 @@ void URLRequestContextConfig::QuicHint::RegisterJSONConverter(
&URLRequestContextConfig::QuicHint::alternate_port);
}
+URLRequestContextConfig::Pkp::Pkp() {}
pauljensen 2015/12/01 20:50:13 add newline between braces to match line 121
kapishnikov 2015/12/02 22:11:37 I am running "git cl format" and it moves the clos
+
+URLRequestContextConfig::Pkp::~Pkp() {}
pauljensen 2015/12/01 20:50:13 ditto
kapishnikov 2015/12/02 22:11:36 Same here.
+
+// 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() {}
@@ -212,6 +240,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