Chromium Code Reviews| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 59 const scoped_refptr<net::URLRequestContextGetter>& request_context); | 59 const scoped_refptr<net::URLRequestContextGetter>& request_context); |
| 60 virtual ~CaptivePortalDetector(); | 60 virtual ~CaptivePortalDetector(); |
| 61 | 61 |
| 62 // Triggers a check for a captive portal. After completion, runs the | 62 // Triggers a check for a captive portal. After completion, runs the |
| 63 // |callback|. | 63 // |callback|. |
| 64 void DetectCaptivePortal(const GURL& url, const DetectionCallback& callback); | 64 void DetectCaptivePortal(const GURL& url, const DetectionCallback& callback); |
| 65 | 65 |
| 66 // Cancels captive portal check. | 66 // Cancels captive portal check. |
| 67 void Cancel(); | 67 void Cancel(); |
| 68 | 68 |
| 69 static std::string CaptivePortalResultToString(Result result); | |
|
Nikita (slow)
2012/11/21 11:32:10
Static should go first.
ygorshenin1
2012/11/21 12:11:11
Done.
| |
| 70 | |
| 69 private: | 71 private: |
| 70 friend class CaptivePortalDetectorTestBase; | 72 friend class CaptivePortalDetectorTestBase; |
| 71 | 73 |
| 72 // net::URLFetcherDelegate: | 74 // net::URLFetcherDelegate: |
| 73 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; | 75 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; |
| 74 | 76 |
| 75 // Takes a net::URLFetcher that has finished trying to retrieve the | 77 // Takes a net::URLFetcher that has finished trying to retrieve the |
| 76 // test URL, and fills a Results struct based on its result. If the | 78 // test URL, and fills a Results struct based on its result. If the |
| 77 // response is a 503 with a Retry-After header, |retry_after| field | 79 // response is a 503 with a Retry-After header, |retry_after| field |
| 78 // of |results| is populated accordingly. Otherwise, it's set to | 80 // of |results| is populated accordingly. Otherwise, it's set to |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 106 | 108 |
| 107 // Test time used by unit tests. | 109 // Test time used by unit tests. |
| 108 base::Time time_for_testing_; | 110 base::Time time_for_testing_; |
| 109 | 111 |
| 110 DISALLOW_COPY_AND_ASSIGN(CaptivePortalDetector); | 112 DISALLOW_COPY_AND_ASSIGN(CaptivePortalDetector); |
| 111 }; | 113 }; |
| 112 | 114 |
| 113 } // namespace captive_portal | 115 } // namespace captive_portal |
| 114 | 116 |
| 115 #endif // CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_DETECTOR_H_ | 117 #endif // CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_DETECTOR_H_ |
| OLD | NEW |