| 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 COMPONENTS_CAPTIVE_PORTAL_CAPTIVE_PORTAL_DETECTOR_H_ | 5 #ifndef COMPONENTS_CAPTIVE_PORTAL_CAPTIVE_PORTAL_DETECTOR_H_ |
| 6 #define COMPONENTS_CAPTIVE_PORTAL_CAPTIVE_PORTAL_DETECTOR_H_ | 6 #define COMPONENTS_CAPTIVE_PORTAL_CAPTIVE_PORTAL_DETECTOR_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/threading/non_thread_safe.h" | 14 #include "base/sequence_checker.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "components/captive_portal/captive_portal_export.h" | 16 #include "components/captive_portal/captive_portal_export.h" |
| 17 #include "components/captive_portal/captive_portal_types.h" | 17 #include "components/captive_portal/captive_portal_types.h" |
| 18 #include "net/traffic_annotation/network_traffic_annotation.h" | 18 #include "net/traffic_annotation/network_traffic_annotation.h" |
| 19 #include "net/url_request/url_fetcher.h" | 19 #include "net/url_request/url_fetcher.h" |
| 20 #include "net/url_request/url_fetcher_delegate.h" | 20 #include "net/url_request/url_fetcher_delegate.h" |
| 21 #include "net/url_request/url_request_context_getter.h" | 21 #include "net/url_request/url_request_context_getter.h" |
| 22 | 22 |
| 23 class GURL; | 23 class GURL; |
| 24 | 24 |
| 25 namespace captive_portal { | 25 namespace captive_portal { |
| 26 | 26 |
| 27 class CAPTIVE_PORTAL_EXPORT CaptivePortalDetector | 27 class CAPTIVE_PORTAL_EXPORT CaptivePortalDetector |
| 28 : public net::URLFetcherDelegate, | 28 : public net::URLFetcherDelegate { |
| 29 public base::NonThreadSafe { | |
| 30 public: | 29 public: |
| 31 struct Results { | 30 struct Results { |
| 32 Results() | 31 Results() |
| 33 : result(captive_portal::RESULT_NO_RESPONSE), | 32 : result(captive_portal::RESULT_NO_RESPONSE), |
| 34 response_code(net::URLFetcher::RESPONSE_CODE_INVALID) { | 33 response_code(net::URLFetcher::RESPONSE_CODE_INVALID) { |
| 35 } | 34 } |
| 36 | 35 |
| 37 captive_portal::CaptivePortalResult result; | 36 captive_portal::CaptivePortalResult result; |
| 38 int response_code; | 37 int response_code; |
| 39 base::TimeDelta retry_after_delta; | 38 base::TimeDelta retry_after_delta; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 // URL request context. | 96 // URL request context. |
| 98 scoped_refptr<net::URLRequestContextGetter> request_context_; | 97 scoped_refptr<net::URLRequestContextGetter> request_context_; |
| 99 | 98 |
| 100 DetectionCallback detection_callback_; | 99 DetectionCallback detection_callback_; |
| 101 | 100 |
| 102 std::unique_ptr<net::URLFetcher> url_fetcher_; | 101 std::unique_ptr<net::URLFetcher> url_fetcher_; |
| 103 | 102 |
| 104 // Test time used by unit tests. | 103 // Test time used by unit tests. |
| 105 base::Time time_for_testing_; | 104 base::Time time_for_testing_; |
| 106 | 105 |
| 106 SEQUENCE_CHECKER(sequence_checker_); |
| 107 |
| 107 DISALLOW_COPY_AND_ASSIGN(CaptivePortalDetector); | 108 DISALLOW_COPY_AND_ASSIGN(CaptivePortalDetector); |
| 108 }; | 109 }; |
| 109 | 110 |
| 110 } // namespace captive_portal | 111 } // namespace captive_portal |
| 111 | 112 |
| 112 #endif // COMPONENTS_CAPTIVE_PORTAL_CAPTIVE_PORTAL_DETECTOR_H_ | 113 #endif // COMPONENTS_CAPTIVE_PORTAL_CAPTIVE_PORTAL_DETECTOR_H_ |
| OLD | NEW |