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

Side by Side Diff: components/data_reduction_proxy/browser/data_reduction_proxy_params.cc

Issue 568893002: Trigger data reduction proxy unreachable message via on proxy fall back. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" 5 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 if (proxy_info) { 345 if (proxy_info) {
346 proxy_info->proxy_servers.first = ssl_origin(); 346 proxy_info->proxy_servers.first = ssl_origin();
347 proxy_info->proxy_servers.second = GURL(); 347 proxy_info->proxy_servers.second = GURL();
348 proxy_info->is_ssl = true; 348 proxy_info->is_ssl = true;
349 } 349 }
350 return true; 350 return true;
351 } 351 }
352 return false; 352 return false;
353 } 353 }
354 354
355 // TODO(kundaji): Check that the request will actually be sent through the
356 // proxy.
357 bool DataReductionProxyParams::IsDataReductionProxyEligible(
358 const net::URLRequest* request) {
359 DCHECK(request);
360 DCHECK(request->context());
361 DCHECK(request->context()->proxy_service());
362 net::ProxyInfo result;
363 request->context()->proxy_service()->config().proxy_rules().Apply(
364 request->url(), &result);
365 if (!result.proxy_server().is_valid())
366 return false;
367 if (result.proxy_server().is_direct())
368 return false;
369 return IsDataReductionProxy(result.proxy_server().host_port_pair(), NULL);
370 }
371
372 bool DataReductionProxyParams::IsBypassedByDataReductionProxyLocalRules( 355 bool DataReductionProxyParams::IsBypassedByDataReductionProxyLocalRules(
373 const net::URLRequest& request, 356 const net::URLRequest& request,
374 const net::ProxyConfig& data_reduction_proxy_config) const { 357 const net::ProxyConfig& data_reduction_proxy_config) const {
375 DCHECK(request.context()); 358 DCHECK(request.context());
376 DCHECK(request.context()->proxy_service()); 359 DCHECK(request.context()->proxy_service());
377 net::ProxyInfo result; 360 net::ProxyInfo result;
378 data_reduction_proxy_config.proxy_rules().Apply( 361 data_reduction_proxy_config.proxy_rules().Apply(
379 request.url(), &result); 362 request.url(), &result);
380 if (!result.proxy_server().is_valid()) 363 if (!result.proxy_server().is_valid())
381 return true; 364 return true;
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 } 523 }
541 524
542 std::string DataReductionProxyParams::GetDefaultWarmupURL() const { 525 std::string DataReductionProxyParams::GetDefaultWarmupURL() const {
543 #if defined(DATA_REDUCTION_PROXY_WARMUP_URL) 526 #if defined(DATA_REDUCTION_PROXY_WARMUP_URL)
544 return DATA_REDUCTION_PROXY_WARMUP_URL; 527 return DATA_REDUCTION_PROXY_WARMUP_URL;
545 #endif 528 #endif
546 return std::string(); 529 return std::string();
547 } 530 }
548 531
549 } // namespace data_reduction_proxy 532 } // namespace data_reduction_proxy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698