Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(482)

Side by Side Diff: chrome/browser/captive_portal/captive_portal_service.h

Issue 15517005: Remove references to Profile from browser_context_keyed_service. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase & style Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "base/threading/non_thread_safe.h" 11 #include "base/threading/non_thread_safe.h"
12 #include "base/time.h" 12 #include "base/time.h"
13 #include "base/timer.h" 13 #include "base/timer.h"
14 #include "chrome/browser/captive_portal/captive_portal_detector.h" 14 #include "chrome/browser/captive_portal/captive_portal_detector.h"
15 #include "components/browser_context_keyed_service/browser_context_keyed_service .h" 15 #include "components/browser_context_keyed_service/browser_context_keyed_service .h"
16 #include "googleurl/src/gurl.h" 16 #include "googleurl/src/gurl.h"
17 #include "net/base/backoff_entry.h" 17 #include "net/base/backoff_entry.h"
18 18
19 class Profile; 19 class Profile;
20 20
21 namespace captive_portal { 21 namespace captive_portal {
22 22
23 // Service that checks for captive portals when queried, and sends a 23 // Service that checks for captive portals when queried, and sends a
24 // NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT with the Profile as the source and 24 // NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT with the Profile as the source and
25 // a CaptivePortalService::Results as the details. 25 // a CaptivePortalService::Results as the details.
26 // 26 //
27 // Captive portal checks are rate-limited. The CaptivePortalService may only 27 // Captive portal checks are rate-limited. The CaptivePortalService may only
28 // be accessed on the UI thread. 28 // be accessed on the UI thread.
29 // Design doc: https://docs.google.com/document/d/1k-gP2sswzYNvryu9NcgN7q5XrsMlU dlUdoW9WRaEmfM/edit 29 // Design doc: https://docs.google.com/document/d/1k-gP2sswzYNvryu9NcgN7q5XrsMlU dlUdoW9WRaEmfM/edit
30 class CaptivePortalService : public ProfileKeyedService, 30 class CaptivePortalService : public BrowserContextKeyedService,
31 public base::NonThreadSafe { 31 public base::NonThreadSafe {
32 public: 32 public:
33 enum TestingState { 33 enum TestingState {
34 NOT_TESTING, 34 NOT_TESTING,
35 DISABLED_FOR_TESTING, // The service is always disabled. 35 DISABLED_FOR_TESTING, // The service is always disabled.
36 SKIP_OS_CHECK_FOR_TESTING // The service can be enabled even if the OS has 36 SKIP_OS_CHECK_FOR_TESTING // The service can be enabled even if the OS has
37 // native captive portal detection. 37 // native captive portal detection.
38 }; 38 };
39 39
40 // The details sent via a NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT. 40 // The details sent via a NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT.
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 }; 107 };
108 108
109 // Initiates a captive portal check, without any throttling. If the service 109 // Initiates a captive portal check, without any throttling. If the service
110 // is disabled, just acts like there's an Internet connection. 110 // is disabled, just acts like there's an Internet connection.
111 void DetectCaptivePortalInternal(); 111 void DetectCaptivePortalInternal();
112 112
113 // Called by CaptivePortalDetector when detection completes. 113 // Called by CaptivePortalDetector when detection completes.
114 void OnPortalDetectionCompleted( 114 void OnPortalDetectionCompleted(
115 const CaptivePortalDetector::Results& results); 115 const CaptivePortalDetector::Results& results);
116 116
117 // ProfileKeyedService: 117 // BrowserContextKeyedService:
118 virtual void Shutdown() OVERRIDE; 118 virtual void Shutdown() OVERRIDE;
119 119
120 // Called when a captive portal check completes. Passes the result to all 120 // Called when a captive portal check completes. Passes the result to all
121 // observers. 121 // observers.
122 void OnResult(Result result); 122 void OnResult(Result result);
123 123
124 // Updates BackoffEntry::Policy and creates a new BackoffEntry, which 124 // Updates BackoffEntry::Policy and creates a new BackoffEntry, which
125 // resets the count used for throttling. 125 // resets the count used for throttling.
126 void ResetBackoffEntry(Result result); 126 void ResetBackoffEntry(Result result);
127 127
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 204
205 // Test time ticks used by unit tests. 205 // Test time ticks used by unit tests.
206 base::TimeTicks time_ticks_for_testing_; 206 base::TimeTicks time_ticks_for_testing_;
207 207
208 DISALLOW_COPY_AND_ASSIGN(CaptivePortalService); 208 DISALLOW_COPY_AND_ASSIGN(CaptivePortalService);
209 }; 209 };
210 210
211 } // namespace captive_portal 211 } // namespace captive_portal
212 212
213 #endif // CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_SERVICE_H_ 213 #endif // CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698