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 #ifndef CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_DETECTOR_H_ | 5 #ifndef CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_DETECTOR_H_ |
6 #define CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_DETECTOR_H_ | 6 #define CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_DETECTOR_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 20 matching lines...) Expand all Loading... | |
31 RESULT_BEHIND_CAPTIVE_PORTAL, | 31 RESULT_BEHIND_CAPTIVE_PORTAL, |
32 RESULT_COUNT | 32 RESULT_COUNT |
33 }; | 33 }; |
34 | 34 |
35 class CaptivePortalDetector : public net::URLFetcherDelegate, | 35 class CaptivePortalDetector : public net::URLFetcherDelegate, |
36 public base::NonThreadSafe { | 36 public base::NonThreadSafe { |
37 public: | 37 public: |
38 struct Results { | 38 struct Results { |
39 Results() | 39 Results() |
40 : result(RESULT_NO_RESPONSE), | 40 : result(RESULT_NO_RESPONSE), |
41 response_code(net::URLFetcher::RESPONSE_CODE_INVALID) { | 41 response_code(net::URLFetcher::RESPONSE_CODE_INVALID), |
42 is_response_https(false) { | |
42 } | 43 } |
43 | 44 |
44 Result result; | 45 Result result; |
45 int response_code; | 46 int response_code; |
46 base::TimeDelta retry_after_delta; | 47 base::TimeDelta retry_after_delta; |
48 bool is_response_https; | |
mmenke
2014/03/26 14:46:08
This should be was_redirected_to_https, since the
meacer
2014/03/26 17:04:57
Done.
| |
47 }; | 49 }; |
48 | 50 |
49 typedef base::Callback<void(const Results& results)> DetectionCallback; | 51 typedef base::Callback<void(const Results& results)> DetectionCallback; |
50 | 52 |
51 // The test URL. When connected to the Internet, it should return a | 53 // The test URL. When connected to the Internet, it should return a |
52 // blank page with a 204 status code. When behind a captive portal, | 54 // blank page with a 204 status code. When behind a captive portal, |
53 // requests for this URL should get an HTTP redirect or a login | 55 // requests for this URL should get an HTTP redirect or a login |
54 // page. When neither is true, no server should respond to requests | 56 // page. When neither is true, no server should respond to requests |
55 // for this URL. | 57 // for this URL. |
56 static const char kDefaultURL[]; | 58 static const char kDefaultURL[]; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
108 | 110 |
109 // Test time used by unit tests. | 111 // Test time used by unit tests. |
110 base::Time time_for_testing_; | 112 base::Time time_for_testing_; |
111 | 113 |
112 DISALLOW_COPY_AND_ASSIGN(CaptivePortalDetector); | 114 DISALLOW_COPY_AND_ASSIGN(CaptivePortalDetector); |
113 }; | 115 }; |
114 | 116 |
115 } // namespace captive_portal | 117 } // namespace captive_portal |
116 | 118 |
117 #endif // CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_DETECTOR_H_ | 119 #endif // CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_DETECTOR_H_ |
OLD | NEW |