OLD | NEW |
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_detector.h" | 5 #include "chrome/browser/captive_portal/captive_portal_detector.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "net/base/load_flags.h" | 10 #include "net/base/load_flags.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 DCHECK(detection_callback_.is_null()); | 53 DCHECK(detection_callback_.is_null()); |
54 | 54 |
55 detection_callback_ = detection_callback; | 55 detection_callback_ = detection_callback; |
56 | 56 |
57 // The first 0 means this can use a TestURLFetcherFactory in unit tests. | 57 // The first 0 means this can use a TestURLFetcherFactory in unit tests. |
58 url_fetcher_.reset(net::URLFetcher::Create(0, | 58 url_fetcher_.reset(net::URLFetcher::Create(0, |
59 url, | 59 url, |
60 net::URLFetcher::GET, | 60 net::URLFetcher::GET, |
61 this)); | 61 this)); |
62 url_fetcher_->SetAutomaticallyRetryOn5xx(false); | 62 url_fetcher_->SetAutomaticallyRetryOn5xx(false); |
63 url_fetcher_->SetRequestContext(request_context_); | 63 url_fetcher_->SetRequestContext(request_context_.get()); |
64 | 64 |
65 // Can't safely use net::LOAD_DISABLE_CERT_REVOCATION_CHECKING here, | 65 // Can't safely use net::LOAD_DISABLE_CERT_REVOCATION_CHECKING here, |
66 // since then the connection may be reused without checking the cert. | 66 // since then the connection may be reused without checking the cert. |
67 url_fetcher_->SetLoadFlags( | 67 url_fetcher_->SetLoadFlags( |
68 net::LOAD_BYPASS_CACHE | | 68 net::LOAD_BYPASS_CACHE | |
69 net::LOAD_DO_NOT_PROMPT_FOR_LOGIN | | 69 net::LOAD_DO_NOT_PROMPT_FOR_LOGIN | |
70 net::LOAD_DO_NOT_SAVE_COOKIES | | 70 net::LOAD_DO_NOT_SAVE_COOKIES | |
71 net::LOAD_DO_NOT_SEND_COOKIES | | 71 net::LOAD_DO_NOT_SEND_COOKIES | |
72 net::LOAD_DO_NOT_SEND_AUTH_DATA); | 72 net::LOAD_DO_NOT_SEND_AUTH_DATA); |
73 url_fetcher_->Start(); | 73 url_fetcher_->Start(); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 return base::Time::Now(); | 160 return base::Time::Now(); |
161 else | 161 else |
162 return time_for_testing_; | 162 return time_for_testing_; |
163 } | 163 } |
164 | 164 |
165 bool CaptivePortalDetector::FetchingURL() const { | 165 bool CaptivePortalDetector::FetchingURL() const { |
166 return url_fetcher_.get() != NULL; | 166 return url_fetcher_.get() != NULL; |
167 } | 167 } |
168 | 168 |
169 } // namespace captive_portal | 169 } // namespace captive_portal |
OLD | NEW |