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

Side by Side Diff: components/wifi_sync/wifi_credential_syncable_service_factory.h

Issue 876833002: wifi_sync: allow WifiCredentialSyncableServiceFactory to ignore LoginState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@submit-4.3-syncable-service
Patch Set: add comments explaining use of BrowserContext::GetPath() Created 5 years, 10 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
OLDNEW
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 "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/singleton.h" 10 #include "base/memory/singleton.h"
10 #include "components/keyed_service/content/browser_context_keyed_service_factory .h" 11 #include "components/keyed_service/content/browser_context_keyed_service_factory .h"
11 12
12 namespace content { 13 namespace content {
13 class BrowserContext; 14 class BrowserContext;
14 } 15 }
15 16
16 namespace wifi_sync { 17 namespace wifi_sync {
17 18
19 class WifiConfigDelegate;
18 class WifiCredentialSyncableService; 20 class WifiCredentialSyncableService;
19 21
20 // Singleton that owns all WifiCredentialSyncableServices and 22 // Singleton that owns all WifiCredentialSyncableServices and
21 // associates them with Profiles. Listens for the Profile's 23 // associates them with Profiles. Listens for the Profile's
22 // destruction notification and cleans up the associated 24 // destruction notification and cleans up the associated
23 // WifiCredentialSyncableServices. 25 // WifiCredentialSyncableServices.
24 class WifiCredentialSyncableServiceFactory 26 class WifiCredentialSyncableServiceFactory
25 : public BrowserContextKeyedServiceFactory { 27 : public BrowserContextKeyedServiceFactory {
26 public: 28 public:
27 // Returns the SyncableService for |browser_context|, creating the 29 // Returns the SyncableService for |browser_context|, creating the
28 // SyncableService if one does not already exist. 30 // SyncableService if one does not already exist.
29 static WifiCredentialSyncableService* GetForBrowserContext( 31 static WifiCredentialSyncableService* GetForBrowserContext(
30 content::BrowserContext* browser_context); 32 content::BrowserContext* browser_context);
31 33
32 // Returns the singleton instance. As this class has no public 34 // 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(); 35 static WifiCredentialSyncableServiceFactory* GetInstance();
37 36
37 #if defined(OS_CHROMEOS)
38 void set_ignore_login_state_for_test(bool new_value) {
39 ignore_login_state_for_test_ = new_value;
40 }
41 #endif
42
38 private: 43 private:
39 friend struct DefaultSingletonTraits<WifiCredentialSyncableServiceFactory>; 44 friend struct DefaultSingletonTraits<WifiCredentialSyncableServiceFactory>;
40 45
41 WifiCredentialSyncableServiceFactory(); 46 WifiCredentialSyncableServiceFactory();
42 ~WifiCredentialSyncableServiceFactory() override; 47 ~WifiCredentialSyncableServiceFactory() override;
43 48
44 // BrowserContextKeyedServiceFactory implementation. 49 // BrowserContextKeyedServiceFactory implementation.
45 KeyedService* BuildServiceInstanceFor( 50 KeyedService* BuildServiceInstanceFor(
46 content::BrowserContext* context) const override; 51 content::BrowserContext* context) const override;
47 52
53 #if defined(OS_CHROMEOS)
54 // Returns a scoped pointer to a WifiConfigDelegate, which can be
55 // used to configure the ChromeOS Wi-Fi settings associated with
56 // |context|.
57 scoped_ptr<WifiConfigDelegate> BuildWifiConfigDelegateChromeOs(
58 content::BrowserContext* context) const;
59 #endif
60
61 #if defined(OS_CHROMEOS)
62 // Whether or not we should use LoginState to associate a new
63 // SyncableService with a Shill profile. Should be set to true in
64 // sync integration tests, where it is not possible to control
65 // LoginState at the time SyncableServices are constructed.
66 bool ignore_login_state_for_test_ = false;
67 #endif
68
48 DISALLOW_COPY_AND_ASSIGN(WifiCredentialSyncableServiceFactory); 69 DISALLOW_COPY_AND_ASSIGN(WifiCredentialSyncableServiceFactory);
49 }; 70 };
50 71
51 } // namespace wifi_sync 72 } // namespace wifi_sync
52 73
53 #endif // COMPONENTS_WIFI_SYNC_WIFI_CREDENTIAL_SYNCABLE_SERVICE_FACTORY_H_ 74 #endif // COMPONENTS_WIFI_SYNC_WIFI_CREDENTIAL_SYNCABLE_SERVICE_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698