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

Unified Diff: components/data_reduction_proxy/core/common/data_reduction_proxy_util.cc

Issue 2072233004: Moving utility methods in data_reduction_proxy to util namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/data_reduction_proxy/core/common/data_reduction_proxy_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/data_reduction_proxy/core/common/data_reduction_proxy_util.cc
diff --git a/components/data_reduction_proxy/core/common/data_reduction_proxy_util.cc b/components/data_reduction_proxy/core/common/data_reduction_proxy_util.cc
index ab3844578dc3a053f4d91d70b65ed985d800ec9d..b691faf0b538ca80680385d7c864e1e4b942d37e 100644
--- a/components/data_reduction_proxy/core/common/data_reduction_proxy_util.cc
+++ b/components/data_reduction_proxy/core/common/data_reduction_proxy_util.cc
@@ -16,20 +16,22 @@
namespace data_reduction_proxy {
namespace {
#if defined(USE_GOOGLE_API_KEYS)
// Used in all Data Reduction Proxy URLs to specify API Key.
const char kApiKeyName[] = "key";
#endif
} // namespace
+namespace util {
+
bool IsMethodIdempotent(const std::string& method) {
return method == "GET" || method == "OPTIONS" || method == "HEAD" ||
method == "PUT" || method == "DELETE" || method == "TRACE";
}
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()) {
@@ -51,20 +53,22 @@ bool ApplyProxyConfigToProxyInfo(const net::ProxyConfig& proxy_config,
const GURL& url,
net::ProxyInfo* data_reduction_proxy_info) {
DCHECK(data_reduction_proxy_info);
if (!proxy_config.is_valid())
return false;
proxy_config.proxy_rules().Apply(url, data_reduction_proxy_info);
data_reduction_proxy_info->DeprioritizeBadProxies(proxy_retry_info);
return !data_reduction_proxy_info->proxy_server().is_direct();
}
+} // namespace util
+
namespace protobuf_parser {
net::ProxyServer::Scheme SchemeFromProxyScheme(
ProxyServer_ProxyScheme proxy_scheme) {
switch (proxy_scheme) {
case ProxyServer_ProxyScheme_HTTP:
return net::ProxyServer::SCHEME_HTTP;
case ProxyServer_ProxyScheme_HTTPS:
return net::ProxyServer::SCHEME_HTTPS;
case ProxyServer_ProxyScheme_QUIC:
« no previous file with comments | « components/data_reduction_proxy/core/common/data_reduction_proxy_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698