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

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_service.cc

Issue 981633002: Created new URLRequestContext for secure proxy check (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved Secure Proxy check to separate class. Addressed comments. Created 5 years, 9 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/browser/data_reduction_proxy_service.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_service.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_service.cc
index 947f4514a86d17fe364419789e05fe43f949c5d4..734258ed906aac2e526dd93090ebaa7dad95af80 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_service.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_service.cc
@@ -7,17 +7,13 @@
#include "base/sequenced_task_runner.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_statistics_prefs.h"
#include "net/base/load_flags.h"
-#include "net/url_request/url_fetcher.h"
-#include "net/url_request/url_request_status.h"
namespace data_reduction_proxy {
DataReductionProxyService::DataReductionProxyService(
scoped_ptr<DataReductionProxyStatisticsPrefs> statistics_prefs,
- DataReductionProxySettings* settings,
- net::URLRequestContextGetter* request_context_getter)
- : url_request_context_getter_(request_context_getter),
- settings_(settings),
+ DataReductionProxySettings* settings)
+ : settings_(settings),
weak_factory_(this) {
DCHECK(settings);
statistics_prefs_ = statistics_prefs.Pass();
@@ -46,47 +42,4 @@ DataReductionProxyService::GetWeakPtr() {
return weak_factory_.GetWeakPtr();
}
-void DataReductionProxyService::OnURLFetchComplete(
- const net::URLFetcher* source) {
- DCHECK(source == fetcher_.get());
- net::URLRequestStatus status = source->GetStatus();
-
- std::string response;
- source->GetResponseAsString(&response);
-
- fetcher_callback_.Run(response, status);
-}
-
-net::URLFetcher* DataReductionProxyService::GetURLFetcherForSecureProxyCheck(
- const GURL& secure_proxy_check_url) {
- net::URLFetcher* fetcher = net::URLFetcher::Create(
- secure_proxy_check_url, net::URLFetcher::GET, this);
- fetcher->SetLoadFlags(net::LOAD_DISABLE_CACHE | net::LOAD_BYPASS_PROXY);
- DCHECK(url_request_context_getter_);
- fetcher->SetRequestContext(url_request_context_getter_);
- // Configure max retries to be at most kMaxRetries times for 5xx errors.
- static const int kMaxRetries = 5;
- fetcher->SetMaxRetriesOn5xx(kMaxRetries);
- fetcher->SetAutomaticallyRetryOnNetworkChanges(kMaxRetries);
- // The secure proxy check should not be redirected. Since the secure proxy
- // check will inevitably fail if it gets redirected somewhere else (e.g. by a
- // captive portal), short circuit that by giving up on the secure proxy check
- // if it gets redirected.
- fetcher->SetStopOnRedirect(true);
- return fetcher;
-}
-
-void DataReductionProxyService::SecureProxyCheck(
- const GURL& secure_proxy_check_url,
- FetcherResponseCallback fetcher_callback) {
- DCHECK(CalledOnValidThread());
- net::URLFetcher* fetcher =
- GetURLFetcherForSecureProxyCheck(secure_proxy_check_url);
- if (!fetcher)
- return;
- fetcher_.reset(fetcher);
- fetcher_callback_ = fetcher_callback;
- fetcher_->Start();
-}
-
} // namespace data_reduction_proxy

Powered by Google App Engine
This is Rietveld 408576698