summaryrefslogtreecommitdiffstats
path: root/components/data_reduction_proxy
diff options
context:
space:
mode:
authorbengr <bengr@chromium.org>2015-07-08 16:29:50 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-08 23:30:27 +0000
commit86a97cd6d4764236a19ef8c3af7771bbab2db6f1 (patch)
tree05bfc3e23f1e9b05b4a6acb980e5f2427bf9a964 /components/data_reduction_proxy
parentda75e3327379cff94a94de45492ae7475d165a77 (diff)
downloadchromium_src-86a97cd6d4764236a19ef8c3af7771bbab2db6f1.zip
chromium_src-86a97cd6d4764236a19ef8c3af7771bbab2db6f1.tar.gz
chromium_src-86a97cd6d4764236a19ef8c3af7771bbab2db6f1.tar.bz2
Updated Data Saver implementation in Cronet
Updated gyp to not use google_apis, and added a Cronet-specific implemention for a new pure virtual in PersistentPrefStore. BUG=461910 Review URL: https://codereview.chromium.org/1220223007 Cr-Commit-Position: refs/heads/master@{#337940}
Diffstat (limited to 'components/data_reduction_proxy')
-rw-r--r--components/data_reduction_proxy/core/browser/BUILD.gn7
-rw-r--r--components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client.cc10
-rw-r--r--components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.cc9
3 files changed, 18 insertions, 8 deletions
diff --git a/components/data_reduction_proxy/core/browser/BUILD.gn b/components/data_reduction_proxy/core/browser/BUILD.gn
index 22e939a..73fef1f 100644
--- a/components/data_reduction_proxy/core/browser/BUILD.gn
+++ b/components/data_reduction_proxy/core/browser/BUILD.gn
@@ -53,11 +53,14 @@ static_library("browser") {
"//components/data_reduction_proxy/proto:data_reduction_proxy_proto",
"//components/pref_registry",
"//crypto",
+ "//google_apis",
"//net",
"//url",
]
- if (!is_android && !is_ios) {
- deps += [ "//google_apis" ]
+
+ defines = [ "USE_GOOGLE_API_KEYS" ]
+ if (!is_ios) {
+ defines += [ "USE_GOOGLE_API_KEYS_FOR_AUTH_KEY" ]
}
}
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client.cc
index 7498470..ed6b66b 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client.cc
@@ -24,7 +24,6 @@
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h"
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_switches.h"
#include "components/data_reduction_proxy/proto/client_config.pb.h"
-#include "google_apis/google_api_keys.h"
#include "net/base/host_port_pair.h"
#include "net/base/load_flags.h"
#include "net/base/url_util.h"
@@ -34,6 +33,10 @@
#include "net/url_request/url_fetcher.h"
#include "net/url_request/url_request_status.h"
+#if defined(USE_GOOGLE_API_KEYS)
+#include "google_apis/google_api_keys.h"
+#endif
+
namespace data_reduction_proxy {
namespace {
@@ -51,8 +54,10 @@ const char kUMAConfigServiceFetchFailedAttemptsBeforeSuccess[] =
const char kUMAConfigServiceFetchLatency[] =
"DataReductionProxy.ConfigService.FetchLatency";
+#if defined(USE_GOOGLE_API_KEYS)
// Used in all Data Reduction Proxy URLs to specify API Key.
const char kApiKeyName[] = "key";
+#endif
// This is the default backoff policy used to communicate with the Data
// Reduction Proxy configuration service.
@@ -103,11 +108,12 @@ base::TimeDelta CalculateNextConfigRefreshTime(
GURL AddApiKeyToUrl(const GURL& url) {
GURL new_url = url;
+#if defined(USE_GOOGLE_API_KEYS)
std::string api_key = google_apis::GetAPIKey();
if (google_apis::HasKeysConfigured() && !api_key.empty()) {
new_url = net::AppendOrReplaceQueryParameter(url, kApiKeyName, api_key);
}
-
+#endif
return net::AppendOrReplaceQueryParameter(new_url, "alt", "proto");
}
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.cc
index 35dd3bd..8717fcb 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.cc
@@ -28,7 +28,7 @@
#include "net/proxy/proxy_server.h"
#include "net/url_request/url_request.h"
-#if !defined(OS_IOS)
+#if defined(USE_GOOGLE_API_KEYS_FOR_AUTH_KEY)
#include "google_apis/google_api_keys.h"
#endif
@@ -343,14 +343,15 @@ std::string DataReductionProxyRequestOptions::GetDefaultKey() const {
*base::CommandLine::ForCurrentProcess();
std::string key =
command_line.GetSwitchValueASCII(switches::kDataReductionProxyKey);
-// iOS gets the default key from a preprocessor constant. All other
-// platforms get the key from google_apis
+// Chrome on iOS gets the default key from a preprocessor constant. Chrome on
+// Android and Chrome on desktop get the key from google_apis. Cronet and
+// Webview have no default key.
#if defined(OS_IOS)
#if defined(SPDY_PROXY_AUTH_VALUE)
if (key.empty())
key = SPDY_PROXY_AUTH_VALUE;
#endif
-#else
+#elif USE_GOOGLE_API_KEYS_FOR_AUTH_KEY
if (key.empty()) {
key = google_apis::GetSpdyProxyAuthValue();
}