OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_FACTORY_H_ | 5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_FACTORY_H_ |
6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_FACTORY_H_ | 6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_FACTORY_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
10 #include "chrome/browser/profiles/profile.h" | |
11 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" | 10 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" |
12 #include "components/keyed_service/core/keyed_service.h" | 11 #include "components/keyed_service/core/keyed_service.h" |
| 12 #include "components/keyed_service/core/service_access_type.h" |
13 | 13 |
14 class Profile; | 14 class Profile; |
15 | 15 |
16 namespace password_manager { | 16 namespace password_manager { |
17 class PasswordStore; | 17 class PasswordStore; |
18 } | 18 } |
19 | 19 |
20 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && defined(OS_POSIX) | 20 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && defined(OS_POSIX) |
21 // Local profile ids are used to associate resources stored outside the profile | 21 // Local profile ids are used to associate resources stored outside the profile |
22 // directory, like saved passwords in GNOME Keyring / KWallet, with a profile. | 22 // directory, like saved passwords in GNOME Keyring / KWallet, with a profile. |
(...skipping 20 matching lines...) Expand all Loading... |
43 scoped_refptr<password_manager::PasswordStore> password_store_; | 43 scoped_refptr<password_manager::PasswordStore> password_store_; |
44 DISALLOW_COPY_AND_ASSIGN(PasswordStoreService); | 44 DISALLOW_COPY_AND_ASSIGN(PasswordStoreService); |
45 }; | 45 }; |
46 | 46 |
47 // Singleton that owns all PasswordStores and associates them with | 47 // Singleton that owns all PasswordStores and associates them with |
48 // Profiles. | 48 // Profiles. |
49 class PasswordStoreFactory : public BrowserContextKeyedServiceFactory { | 49 class PasswordStoreFactory : public BrowserContextKeyedServiceFactory { |
50 public: | 50 public: |
51 static scoped_refptr<password_manager::PasswordStore> GetForProfile( | 51 static scoped_refptr<password_manager::PasswordStore> GetForProfile( |
52 Profile* profile, | 52 Profile* profile, |
53 Profile::ServiceAccessType set); | 53 ServiceAccessType set); |
54 | 54 |
55 static PasswordStoreFactory* GetInstance(); | 55 static PasswordStoreFactory* GetInstance(); |
56 | 56 |
57 private: | 57 private: |
58 friend struct DefaultSingletonTraits<PasswordStoreFactory>; | 58 friend struct DefaultSingletonTraits<PasswordStoreFactory>; |
59 | 59 |
60 PasswordStoreFactory(); | 60 PasswordStoreFactory(); |
61 ~PasswordStoreFactory() override; | 61 ~PasswordStoreFactory() override; |
62 | 62 |
63 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && defined(OS_POSIX) | 63 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && defined(OS_POSIX) |
64 LocalProfileId GetLocalProfileId(PrefService* prefs) const; | 64 LocalProfileId GetLocalProfileId(PrefService* prefs) const; |
65 #endif | 65 #endif |
66 | 66 |
67 // BrowserContextKeyedServiceFactory: | 67 // BrowserContextKeyedServiceFactory: |
68 KeyedService* BuildServiceInstanceFor( | 68 KeyedService* BuildServiceInstanceFor( |
69 content::BrowserContext* context) const override; | 69 content::BrowserContext* context) const override; |
70 void RegisterProfilePrefs( | 70 void RegisterProfilePrefs( |
71 user_prefs::PrefRegistrySyncable* registry) override; | 71 user_prefs::PrefRegistrySyncable* registry) override; |
72 content::BrowserContext* GetBrowserContextToUse( | 72 content::BrowserContext* GetBrowserContextToUse( |
73 content::BrowserContext* context) const override; | 73 content::BrowserContext* context) const override; |
74 bool ServiceIsNULLWhileTesting() const override; | 74 bool ServiceIsNULLWhileTesting() const override; |
75 | 75 |
76 DISALLOW_COPY_AND_ASSIGN(PasswordStoreFactory); | 76 DISALLOW_COPY_AND_ASSIGN(PasswordStoreFactory); |
77 }; | 77 }; |
78 | 78 |
79 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_FACTORY_H_ | 79 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_FACTORY_H_ |
OLD | NEW |