ExtensionSyncService: listen for relevant changes instead of being explicitly called...
[chromium-blink-merge.git] / chrome / browser / autofill / personal_data_manager_factory.h
blob1f69b75a0269c83123bc2c5ed8fc505408c143bb
1 // Copyright (c) 2011 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 CHROME_BROWSER_AUTOFILL_PERSONAL_DATA_MANAGER_FACTORY_H_
6 #define CHROME_BROWSER_AUTOFILL_PERSONAL_DATA_MANAGER_FACTORY_H_
8 #include "base/compiler_specific.h"
9 #include "components/keyed_service/content/browser_context_keyed_service_factory.h"
10 #include "components/keyed_service/core/keyed_service.h"
12 template <typename T> struct DefaultSingletonTraits;
13 class Profile;
15 namespace autofill {
17 class PersonalDataManager;
19 // Singleton that owns all PersonalDataManagers and associates them with
20 // Profiles.
21 // Listens for the Profile's destruction notification and cleans up the
22 // associated PersonalDataManager.
23 class PersonalDataManagerFactory : public BrowserContextKeyedServiceFactory {
24 public:
25 // Returns the PersonalDataManager for |profile|, creating it if it is not
26 // yet created.
27 static PersonalDataManager* GetForProfile(Profile* profile);
29 static PersonalDataManagerFactory* GetInstance();
31 private:
32 friend struct DefaultSingletonTraits<PersonalDataManagerFactory>;
34 PersonalDataManagerFactory();
35 ~PersonalDataManagerFactory() override;
37 // BrowserContextKeyedServiceFactory:
38 KeyedService* BuildServiceInstanceFor(
39 content::BrowserContext* profile) const override;
40 content::BrowserContext* GetBrowserContextToUse(
41 content::BrowserContext* context) const override;
44 } // namespace autofill
46 #endif // CHROME_BROWSER_AUTOFILL_PERSONAL_DATA_MANAGER_FACTORY_H_