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

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

Issue 863203009: Store Proxy Servers as proxy servers and not GURLs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed failing test code. Created 5 years, 10 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
Index: components/data_reduction_proxy/core/common/data_reduction_proxy_event_store.cc
diff --git a/components/data_reduction_proxy/core/common/data_reduction_proxy_event_store.cc b/components/data_reduction_proxy/core/common/data_reduction_proxy_event_store.cc
index 84dc2f56da7c8b4e675dd94c40f556498dd94755..d7fce59d1094fd84ce0de81354f2e50fb1f27675 100644
--- a/components/data_reduction_proxy/core/common/data_reduction_proxy_event_store.cc
+++ b/components/data_reduction_proxy/core/common/data_reduction_proxy_event_store.cc
@@ -16,6 +16,7 @@
#include "base/values.h"
#include "net/base/host_port_pair.h"
#include "net/base/net_log.h"
+#include "net/proxy/proxy_server.h"
#include "url/gurl.h"
namespace {
@@ -58,18 +59,12 @@ int64 GetExpirationTicks(int bypass_seconds) {
// The following method creates a string resembling the output of
// net::ProxyServer::ToURI().
std::string GetNormalizedProxyString(const std::string& proxy_origin) {
- GURL proxy_url(proxy_origin);
- if (proxy_url.is_valid()) {
- net::HostPortPair proxy_host_port_pair =
- net::HostPortPair::FromURL(proxy_url);
- if (proxy_url.SchemeIs(url::kHttpScheme))
- return proxy_host_port_pair.ToString();
-
- return std::string(proxy_url.scheme()) + url::kStandardSchemeSeparator +
- proxy_host_port_pair.ToString();
- } else {
+ net::ProxyServer proxy_server = net::ProxyServer::FromURI(
+ proxy_origin, net::ProxyServer::SCHEME_HTTP);
+ if (proxy_server.is_valid())
+ return proxy_origin;
+ else
return std::string();
- }
}
// The following callbacks create a base::Value which contains information

Powered by Google App Engine
This is Rietveld 408576698