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

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: Small changes and rebase Created 5 years 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
« no previous file with comments | « components/cronet/url_request_context_config.h ('k') | components/cronet/url_request_context_config_list.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..2845bc8746c1f07fec3a568aca622ccb725c6e94 100644
--- a/components/cronet/url_request_context_config.cc
+++ b/components/cronet/url_request_context_config.cc
@@ -103,17 +103,24 @@ 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;
#include "components/cronet/url_request_context_config_list.h"
#undef DEFINE_CONTEXT_CONFIG
-URLRequestContextConfig::QuicHint::QuicHint() {
-}
+URLRequestContextConfig::QuicHint::QuicHint() {}
-URLRequestContextConfig::QuicHint::~QuicHint() {
-}
+URLRequestContextConfig::QuicHint::~QuicHint() {}
// static
void URLRequestContextConfig::QuicHint::RegisterJSONConverter(
@@ -128,6 +135,25 @@ void URLRequestContextConfig::QuicHint::RegisterJSONConverter(
&URLRequestContextConfig::QuicHint::alternate_port);
}
+URLRequestContextConfig::Pkp::Pkp() {}
+
+URLRequestContextConfig::Pkp::~Pkp() {}
+
+// 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 +238,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>>(
« no previous file with comments | « components/cronet/url_request_context_config.h ('k') | components/cronet/url_request_context_config_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698