Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / autofill / personal_data_manager_factory.h
blobfdff9e17dd90f14368b7fa08e215063a5bcd001e
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/browser_context_keyed_service/browser_context_keyed_service.h"
10 #include "components/browser_context_keyed_service/browser_context_keyed_service_factory.h"
12 template <typename T> struct DefaultSingletonTraits;
13 class Profile;
15 namespace autofill {
17 class PersonalDataManager;
19 // A wrapper of PersonalDataManager so we can use it as a profiled keyed
20 // service. This should only be subclassed in tests, e.g. to provide a mock
21 // PersonalDataManager.
22 class PersonalDataManagerService : public BrowserContextKeyedService {
23 public:
24 virtual PersonalDataManager* GetPersonalDataManager() = 0;
27 // Singleton that owns all PersonalDataManagers and associates them with
28 // Profiles.
29 // Listens for the Profile's destruction notification and cleans up the
30 // associated PersonalDataManager.
31 class PersonalDataManagerFactory : public BrowserContextKeyedServiceFactory {
32 public:
33 // Returns the PersonalDataManager for |profile|, creating it if it is not
34 // yet created.
35 static PersonalDataManager* GetForProfile(Profile* profile);
37 static PersonalDataManagerFactory* GetInstance();
39 private:
40 friend struct DefaultSingletonTraits<PersonalDataManagerFactory>;
42 PersonalDataManagerFactory();
43 virtual ~PersonalDataManagerFactory();
45 // BrowserContextKeyedServiceFactory:
46 virtual BrowserContextKeyedService* BuildServiceInstanceFor(
47 content::BrowserContext* profile) const OVERRIDE;
48 virtual content::BrowserContext* GetBrowserContextToUse(
49 content::BrowserContext* context) const OVERRIDE;
52 } // namespace autofill
54 #endif // CHROME_BROWSER_AUTOFILL_PERSONAL_DATA_MANAGER_FACTORY_H_