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

Side by Side Diff: chrome/browser/captive_portal/captive_portal_service.cc

Issue 10554008: Move content::URLFetcher static functions to net::URLFetcher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix win link error Created 8 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 unified diff | Download patch | Annotate | Revision Log
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 "chrome/browser/captive_portal/captive_portal_service.h" 5 #include "chrome/browser/captive_portal/captive_portal_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
11 #include "base/metrics/histogram.h" 11 #include "base/metrics/histogram.h"
12 #include "base/rand_util.h" 12 #include "base/rand_util.h"
13 #include "base/string_number_conversions.h" 13 #include "base/string_number_conversions.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/common/chrome_notification_types.h" 15 #include "chrome/common/chrome_notification_types.h"
16 #include "chrome/common/chrome_switches.h" 16 #include "chrome/common/chrome_switches.h"
17 #include "chrome/common/pref_names.h" 17 #include "chrome/common/pref_names.h"
18 #include "content/public/browser/notification_service.h" 18 #include "content/public/browser/notification_service.h"
19 #include "content/public/common/url_fetcher.h"
20 #include "net/base/load_flags.h" 19 #include "net/base/load_flags.h"
21 #include "net/http/http_response_headers.h" 20 #include "net/http/http_response_headers.h"
21 #include "net/url_request/url_fetcher.h"
22 #include "net/url_request/url_request_status.h" 22 #include "net/url_request/url_request_status.h"
23 23
24 namespace captive_portal { 24 namespace captive_portal {
25 25
26 namespace { 26 namespace {
27 27
28 // The test URL. When connected to the Internet, it should return a blank page 28 // The test URL. When connected to the Internet, it should return a blank page
29 // with a 204 status code. When behind a captive portal, requests for this 29 // with a 204 status code. When behind a captive portal, requests for this
30 // URL should get an HTTP redirect or a login page. When neither is true, 30 // URL should get an HTTP redirect or a login page. When neither is true,
31 // no server should respond to requests for this URL. 31 // no server should respond to requests for this URL.
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 // When not enabled, just claim there's an Internet connection. 191 // When not enabled, just claim there's an Internet connection.
192 if (!enabled_) { 192 if (!enabled_) {
193 // Count this as a success, so the backoff entry won't apply exponential 193 // Count this as a success, so the backoff entry won't apply exponential
194 // backoff, but will apply the standard delay. 194 // backoff, but will apply the standard delay.
195 backoff_entry_->InformOfRequest(true); 195 backoff_entry_->InformOfRequest(true);
196 OnResult(RESULT_INTERNET_CONNECTED); 196 OnResult(RESULT_INTERNET_CONNECTED);
197 return; 197 return;
198 } 198 }
199 199
200 // The first 0 means this can use a TestURLFetcherFactory in unit tests. 200 // The first 0 means this can use a TestURLFetcherFactory in unit tests.
201 url_fetcher_.reset(content::URLFetcher::Create(0, 201 url_fetcher_.reset(net::URLFetcher::Create(0,
202 test_url_, 202 test_url_,
203 net::URLFetcher::GET, 203 net::URLFetcher::GET,
204 this)); 204 this));
205 url_fetcher_->SetAutomaticallyRetryOn5xx(false); 205 url_fetcher_->SetAutomaticallyRetryOn5xx(false);
206 url_fetcher_->SetRequestContext(profile_->GetRequestContext()); 206 url_fetcher_->SetRequestContext(profile_->GetRequestContext());
207 // Can't safely use net::LOAD_DISABLE_CERT_REVOCATION_CHECKING here, 207 // Can't safely use net::LOAD_DISABLE_CERT_REVOCATION_CHECKING here,
208 // since then the connection may be reused without checking the cert. 208 // since then the connection may be reused without checking the cert.
209 url_fetcher_->SetLoadFlags( 209 url_fetcher_->SetLoadFlags(
210 net::LOAD_BYPASS_CACHE | 210 net::LOAD_BYPASS_CACHE |
211 net::LOAD_DO_NOT_PROMPT_FOR_LOGIN | 211 net::LOAD_DO_NOT_PROMPT_FOR_LOGIN |
212 net::LOAD_DO_NOT_SAVE_COOKIES | 212 net::LOAD_DO_NOT_SAVE_COOKIES |
213 net::LOAD_DO_NOT_SEND_COOKIES | 213 net::LOAD_DO_NOT_SEND_COOKIES |
214 net::LOAD_DO_NOT_SEND_AUTH_DATA); 214 net::LOAD_DO_NOT_SEND_AUTH_DATA);
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 414
415 bool CaptivePortalService::FetchingURL() const { 415 bool CaptivePortalService::FetchingURL() const {
416 return url_fetcher_.get() != NULL; 416 return url_fetcher_.get() != NULL;
417 } 417 }
418 418
419 bool CaptivePortalService::TimerRunning() const { 419 bool CaptivePortalService::TimerRunning() const {
420 return check_captive_portal_timer_.IsRunning(); 420 return check_captive_portal_timer_.IsRunning();
421 } 421 }
422 422
423 } // namespace captive_portal 423 } // namespace captive_portal
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_download.cc ('k') | chrome/browser/chrome_to_mobile_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698