OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_WIFI_SYNC_WIFI_CREDENTIAL_SYNCABLE_SERVICE_FACTORY_H_ | 5 #ifndef COMPONENTS_WIFI_SYNC_WIFI_CREDENTIAL_SYNCABLE_SERVICE_FACTORY_H_ |
6 #define COMPONENTS_WIFI_SYNC_WIFI_CREDENTIAL_SYNCABLE_SERVICE_FACTORY_H_ | 6 #define COMPONENTS_WIFI_SYNC_WIFI_CREDENTIAL_SYNCABLE_SERVICE_FACTORY_H_ |
7 | 7 |
8 #include <string> | |
9 | |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | |
9 #include "base/memory/singleton.h" | 12 #include "base/memory/singleton.h" |
10 #include "components/keyed_service/content/browser_context_keyed_service_factory .h" | 13 #include "components/keyed_service/content/browser_context_keyed_service_factory .h" |
11 | 14 |
12 namespace content { | 15 namespace content { |
13 class BrowserContext; | 16 class BrowserContext; |
14 } | 17 } |
15 | 18 |
16 namespace wifi_sync { | 19 namespace wifi_sync { |
17 | 20 |
21 class WifiConfigDelegate; | |
18 class WifiCredentialSyncableService; | 22 class WifiCredentialSyncableService; |
19 | 23 |
20 // Singleton that owns all WifiCredentialSyncableServices and | 24 // Singleton that owns all WifiCredentialSyncableServices and |
21 // associates them with Profiles. Listens for the Profile's | 25 // associates them with Profiles. Listens for the Profile's |
22 // destruction notification and cleans up the associated | 26 // destruction notification and cleans up the associated |
23 // WifiCredentialSyncableServices. | 27 // WifiCredentialSyncableServices. |
24 class WifiCredentialSyncableServiceFactory | 28 class WifiCredentialSyncableServiceFactory |
25 : public BrowserContextKeyedServiceFactory { | 29 : public BrowserContextKeyedServiceFactory { |
26 public: | 30 public: |
27 // Returns the SyncableService for |browser_context|, creating the | 31 // Returns the SyncableService for |browser_context|, creating the |
28 // SyncableService if one does not already exist. | 32 // SyncableService if one does not already exist. |
29 static WifiCredentialSyncableService* GetForBrowserContext( | 33 static WifiCredentialSyncableService* GetForBrowserContext( |
30 content::BrowserContext* browser_context); | 34 content::BrowserContext* browser_context); |
31 | 35 |
32 // Returns the singleton instance. As this class has no public | 36 // Returns the singleton instance. |
33 // instance methods, this function is not generally useful for | |
34 // external callers. This function is public only so that the | |
35 // Singleton template can reference it. | |
36 static WifiCredentialSyncableServiceFactory* GetInstance(); | 37 static WifiCredentialSyncableServiceFactory* GetInstance(); |
37 | 38 |
39 #if defined(OS_CHROMEOS) | |
40 void set_ignore_login_state_for_test(bool new_value) { | |
mukesh agrawal
2015/01/28 22:26:27
- After renaming the member variable, the previous
| |
41 ignore_login_state_for_test_ = new_value; | |
42 } | |
43 #endif | |
44 | |
38 private: | 45 private: |
39 friend struct DefaultSingletonTraits<WifiCredentialSyncableServiceFactory>; | 46 friend struct DefaultSingletonTraits<WifiCredentialSyncableServiceFactory>; |
40 | 47 |
41 WifiCredentialSyncableServiceFactory(); | 48 WifiCredentialSyncableServiceFactory(); |
42 ~WifiCredentialSyncableServiceFactory() override; | 49 ~WifiCredentialSyncableServiceFactory() override; |
43 | 50 |
44 // BrowserContextKeyedServiceFactory implementation. | 51 // BrowserContextKeyedServiceFactory implementation. |
45 KeyedService* BuildServiceInstanceFor( | 52 KeyedService* BuildServiceInstanceFor( |
46 content::BrowserContext* context) const override; | 53 content::BrowserContext* context) const override; |
47 | 54 |
55 #if defined(OS_CHROMEOS) | |
56 // Returns a scoped pointer to a WifiConfigDelegate, which can be | |
57 // used to configure the ChromeOS Wi-Fi settings associated with | |
58 // |context|. | |
59 scoped_ptr<WifiConfigDelegate> BuildWifiConfigDelegateChromeOs( | |
60 content::BrowserContext* context) const; | |
61 #endif | |
62 | |
63 #if defined(OS_CHROMEOS) | |
mukesh agrawal
2015/01/28 22:26:27
While this #if block could be collapsed into the p
| |
64 // Whether or not we should use LoginState to associate a new | |
65 // SyncableService with a Shill profile. Should be set to true in | |
66 // sync integration tests, where it is not possible to control | |
67 // LoginState at the time SyncableServices are constructed. | |
68 bool ignore_login_state_for_test_ = false; | |
mukesh agrawal
2015/01/28 22:26:27
Since this field is only present on ChromeOS, I'm
| |
69 #endif | |
70 | |
48 DISALLOW_COPY_AND_ASSIGN(WifiCredentialSyncableServiceFactory); | 71 DISALLOW_COPY_AND_ASSIGN(WifiCredentialSyncableServiceFactory); |
49 }; | 72 }; |
50 | 73 |
51 } // namespace wifi_sync | 74 } // namespace wifi_sync |
52 | 75 |
53 #endif // COMPONENTS_WIFI_SYNC_WIFI_CREDENTIAL_SYNCABLE_SERVICE_FACTORY_H_ | 76 #endif // COMPONENTS_WIFI_SYNC_WIFI_CREDENTIAL_SYNCABLE_SERVICE_FACTORY_H_ |
OLD | NEW |