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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_WIFI_SYNC_WIFI_CREDENTIAL_SYNCABLE_SERVICE_FACTORY_H_
6 #define COMPONENTS_WIFI_SYNC_WIFI_CREDENTIAL_SYNCABLE_SERVICE_FACTORY_H_
8 #include "base/macros.h"
9 #include "base/memory/singleton.h"
10 #include "components/keyed_service/content/browser_context_keyed_service_factory.h"
18 class WifiCredentialSyncableService
;
20 // Singleton that owns all WifiCredentialSyncableServices and
21 // associates them with Profiles. Listens for the Profile's
22 // destruction notification and cleans up the associated
23 // WifiCredentialSyncableServices.
24 class WifiCredentialSyncableServiceFactory
25 : public BrowserContextKeyedServiceFactory
{
27 // Returns the SyncableService for |browser_context|, creating the
28 // SyncableService if one does not already exist.
29 static WifiCredentialSyncableService
* GetForBrowserContext(
30 content::BrowserContext
* browser_context
);
32 // Returns the singleton instance. As this class has no public
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();
39 friend struct DefaultSingletonTraits
<WifiCredentialSyncableServiceFactory
>;
41 WifiCredentialSyncableServiceFactory();
42 ~WifiCredentialSyncableServiceFactory() override
;
44 // Implementation of BrowserContextKeyedServiceFactory.
45 KeyedService
* BuildServiceInstanceFor(
46 content::BrowserContext
* context
) const override
;
48 DISALLOW_COPY_AND_ASSIGN(WifiCredentialSyncableServiceFactory
);
51 } // namespace wifi_sync
53 #endif // COMPONENTS_WIFI_SYNC_WIFI_CREDENTIAL_SYNCABLE_SERVICE_FACTORY_H_