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_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_SERVICE_H_ |
6 #define CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_SERVICE_H_ | 6 #define CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_SERVICE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/prefs/pref_member.h" | 10 #include "base/prefs/pref_member.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 // The details sent via a NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT. | 37 // The details sent via a NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT. |
38 struct Results { | 38 struct Results { |
39 // The result of the second most recent captive portal check. | 39 // The result of the second most recent captive portal check. |
40 captive_portal::CaptivePortalResult previous_result; | 40 captive_portal::CaptivePortalResult previous_result; |
41 // The result of the most recent captive portal check. | 41 // The result of the most recent captive portal check. |
42 captive_portal::CaptivePortalResult result; | 42 captive_portal::CaptivePortalResult result; |
43 }; | 43 }; |
44 | 44 |
45 explicit CaptivePortalService(Profile* profile); | 45 explicit CaptivePortalService(Profile* profile); |
46 virtual ~CaptivePortalService(); | 46 ~CaptivePortalService() override; |
47 | 47 |
48 // Triggers a check for a captive portal. If there's already a check in | 48 // Triggers a check for a captive portal. If there's already a check in |
49 // progress, does nothing. Throttles the rate at which requests are sent. | 49 // progress, does nothing. Throttles the rate at which requests are sent. |
50 // Always sends the result notification asynchronously. | 50 // Always sends the result notification asynchronously. |
51 void DetectCaptivePortal(); | 51 void DetectCaptivePortal(); |
52 | 52 |
53 // Returns the URL used for captive portal testing. When a captive portal is | 53 // Returns the URL used for captive portal testing. When a captive portal is |
54 // detected, this URL will take us to the captive portal landing page. | 54 // detected, this URL will take us to the captive portal landing page. |
55 const GURL& test_url() const { return test_url_; } | 55 const GURL& test_url() const { return test_url_; } |
56 | 56 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 107 |
108 // Initiates a captive portal check, without any throttling. If the service | 108 // Initiates a captive portal check, without any throttling. If the service |
109 // is disabled, just acts like there's an Internet connection. | 109 // is disabled, just acts like there's an Internet connection. |
110 void DetectCaptivePortalInternal(); | 110 void DetectCaptivePortalInternal(); |
111 | 111 |
112 // Called by CaptivePortalDetector when detection completes. | 112 // Called by CaptivePortalDetector when detection completes. |
113 void OnPortalDetectionCompleted( | 113 void OnPortalDetectionCompleted( |
114 const captive_portal::CaptivePortalDetector::Results& results); | 114 const captive_portal::CaptivePortalDetector::Results& results); |
115 | 115 |
116 // KeyedService: | 116 // KeyedService: |
117 virtual void Shutdown() override; | 117 void Shutdown() override; |
118 | 118 |
119 // Called when a captive portal check completes. Passes the result to all | 119 // Called when a captive portal check completes. Passes the result to all |
120 // observers. | 120 // observers. |
121 void OnResult(captive_portal::CaptivePortalResult result); | 121 void OnResult(captive_portal::CaptivePortalResult result); |
122 | 122 |
123 // Updates BackoffEntry::Policy and creates a new BackoffEntry, which | 123 // Updates BackoffEntry::Policy and creates a new BackoffEntry, which |
124 // resets the count used for throttling. | 124 // resets the count used for throttling. |
125 void ResetBackoffEntry(captive_portal::CaptivePortalResult result); | 125 void ResetBackoffEntry(captive_portal::CaptivePortalResult result); |
126 | 126 |
127 // Updates |enabled_| based on command line flags and Profile preferences, | 127 // Updates |enabled_| based on command line flags and Profile preferences, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 | 201 |
202 static TestingState testing_state_; | 202 static TestingState testing_state_; |
203 | 203 |
204 // Test time ticks used by unit tests. | 204 // Test time ticks used by unit tests. |
205 base::TimeTicks time_ticks_for_testing_; | 205 base::TimeTicks time_ticks_for_testing_; |
206 | 206 |
207 DISALLOW_COPY_AND_ASSIGN(CaptivePortalService); | 207 DISALLOW_COPY_AND_ASSIGN(CaptivePortalService); |
208 }; | 208 }; |
209 | 209 |
210 #endif // CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_SERVICE_H_ | 210 #endif // CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_SERVICE_H_ |
OLD | NEW |