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

Side by Side Diff: net/proxy/proxy_service.cc

Issue 382313003: Add data reduction functionality to all platforms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove extra new line. Created 6 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/proxy/proxy_service.h" 5 #include "net/proxy/proxy_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1199 1199
1200 bool re_resolve = result->config_id_ != config_.id(); 1200 bool re_resolve = result->config_id_ != config_.id();
1201 1201
1202 if (re_resolve) { 1202 if (re_resolve) {
1203 // If we have a new config or the config was never tried, we delete the 1203 // If we have a new config or the config was never tried, we delete the
1204 // list of bad proxies and we try again. 1204 // list of bad proxies and we try again.
1205 proxy_retry_info_.clear(); 1205 proxy_retry_info_.clear();
1206 return ResolveProxy(url, load_flags, result, callback, pac_request, 1206 return ResolveProxy(url, load_flags, result, callback, pac_request,
1207 network_delegate, net_log); 1207 network_delegate, net_log);
1208 } 1208 }
1209 1209 const net::ProxyServer& proxy_server = result->proxy_server();
bengr 2014/07/18 19:41:44 Instead of doing it this way, it would probably be
Not at Google. Contact bengr 2014/07/21 17:46:26 Good idea. I went down the path of trying to do it
1210 #if defined(SPDY_PROXY_AUTH_ORIGIN) 1210 if (proxy_server.is_valid() && !proxy_server.is_direct()) {
1211 if (result->proxy_server().isDataReductionProxy()) { 1211 if (proxy_server.host_port_pair().Equals(
1212 RecordDataReductionProxyBypassInfo( 1212 data_reduction_default_origin_)) {
1213 true, false, result->proxy_server(), NETWORK_ERROR); 1213 RecordDataReductionProxyBypassInfo(
1214 RecordDataReductionProxyBypassOnNetworkError( 1214 true, false, proxy_server, NETWORK_ERROR);
1215 true, result->proxy_server(), net_error); 1215 RecordDataReductionProxyBypassOnNetworkError(
1216 } else if (result->proxy_server().isDataReductionProxyFallback()) { 1216 true, proxy_server, net_error);
1217 RecordDataReductionProxyBypassInfo( 1217 } else if (proxy_server.host_port_pair().Equals(
1218 false, false, result->proxy_server(), NETWORK_ERROR); 1218 data_reduction_default_fallback_origin_)) {
1219 RecordDataReductionProxyBypassOnNetworkError( 1219 RecordDataReductionProxyBypassInfo(
1220 false, result->proxy_server(), net_error); 1220 false, false, proxy_server, NETWORK_ERROR);
1221 RecordDataReductionProxyBypassOnNetworkError(
1222 false, proxy_server, net_error);
1223 }
1221 } 1224 }
1222 #endif
1223 1225
1224 // We don't have new proxy settings to try, try to fallback to the next proxy 1226 // We don't have new proxy settings to try, try to fallback to the next proxy
1225 // in the list. 1227 // in the list.
1226 bool did_fallback = result->Fallback(net_log); 1228 bool did_fallback = result->Fallback(net_log);
1227 1229
1228 // Return synchronous failure if there is nothing left to fall-back to. 1230 // Return synchronous failure if there is nothing left to fall-back to.
1229 // TODO(eroman): This is a yucky API, clean it up. 1231 // TODO(eroman): This is a yucky API, clean it up.
1230 return did_fallback ? OK : ERR_FAILED; 1232 return did_fallback ? OK : ERR_FAILED;
1231 } 1233 }
1232 1234
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1391 if (previous_state != STATE_NONE) 1393 if (previous_state != STATE_NONE)
1392 ApplyProxyConfigIfAvailable(); 1394 ApplyProxyConfigIfAvailable();
1393 } 1395 }
1394 1396
1395 void ProxyService::ForceReloadProxyConfig() { 1397 void ProxyService::ForceReloadProxyConfig() {
1396 DCHECK(CalledOnValidThread()); 1398 DCHECK(CalledOnValidThread());
1397 ResetProxyConfig(false); 1399 ResetProxyConfig(false);
1398 ApplyProxyConfigIfAvailable(); 1400 ApplyProxyConfigIfAvailable();
1399 } 1401 }
1400 1402
1403 void ProxyService::SetDataReductionProxyOrigins(
1404 const std::string& data_reduction_default_origin,
1405 const std::string& data_reduction_default_fallback_origin) {
1406 DCHECK(CalledOnValidThread());
1407 data_reduction_default_origin_ =
1408 net::HostPortPair::FromURL(GURL(data_reduction_default_origin));
1409 data_reduction_default_fallback_origin_ =
1410 net::HostPortPair::FromURL(GURL(data_reduction_default_fallback_origin));
1411
1412 }
1413
1401 // static 1414 // static
1402 ProxyConfigService* ProxyService::CreateSystemProxyConfigService( 1415 ProxyConfigService* ProxyService::CreateSystemProxyConfigService(
1403 base::SingleThreadTaskRunner* io_thread_task_runner, 1416 base::SingleThreadTaskRunner* io_thread_task_runner,
1404 base::MessageLoop* file_loop) { 1417 base::MessageLoop* file_loop) {
1405 #if defined(OS_WIN) 1418 #if defined(OS_WIN)
1406 return new ProxyConfigServiceWin(); 1419 return new ProxyConfigServiceWin();
1407 #elif defined(OS_IOS) 1420 #elif defined(OS_IOS)
1408 return new ProxyConfigServiceIOS(); 1421 return new ProxyConfigServiceIOS();
1409 #elif defined(OS_MACOSX) 1422 #elif defined(OS_MACOSX)
1410 return new ProxyConfigServiceMac(io_thread_task_runner); 1423 return new ProxyConfigServiceMac(io_thread_task_runner);
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
1610 State previous_state = ResetProxyConfig(false); 1623 State previous_state = ResetProxyConfig(false);
1611 if (previous_state != STATE_NONE) 1624 if (previous_state != STATE_NONE)
1612 ApplyProxyConfigIfAvailable(); 1625 ApplyProxyConfigIfAvailable();
1613 } 1626 }
1614 1627
1615 void ProxyService::OnDNSChanged() { 1628 void ProxyService::OnDNSChanged() {
1616 OnIPAddressChanged(); 1629 OnIPAddressChanged();
1617 } 1630 }
1618 1631
1619 } // namespace net 1632 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698