| 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" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 public: | 29 public: |
| 30 // |password_store| needs to be not-NULL, and the constructor expects that | 30 // |password_store| needs to be not-NULL, and the constructor expects that |
| 31 // Init() was already called successfully on it. | 31 // Init() was already called successfully on it. |
| 32 explicit PasswordStoreService( | 32 explicit PasswordStoreService( |
| 33 scoped_refptr<password_manager::PasswordStore> password_store); | 33 scoped_refptr<password_manager::PasswordStore> password_store); |
| 34 virtual ~PasswordStoreService(); | 34 virtual ~PasswordStoreService(); |
| 35 | 35 |
| 36 scoped_refptr<password_manager::PasswordStore> GetPasswordStore(); | 36 scoped_refptr<password_manager::PasswordStore> GetPasswordStore(); |
| 37 | 37 |
| 38 // KeyedService implementation. | 38 // KeyedService implementation. |
| 39 virtual void Shutdown() OVERRIDE; | 39 virtual void Shutdown() override; |
| 40 | 40 |
| 41 private: | 41 private: |
| 42 scoped_refptr<password_manager::PasswordStore> password_store_; | 42 scoped_refptr<password_manager::PasswordStore> password_store_; |
| 43 DISALLOW_COPY_AND_ASSIGN(PasswordStoreService); | 43 DISALLOW_COPY_AND_ASSIGN(PasswordStoreService); |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 // Singleton that owns all PasswordStores and associates them with | 46 // Singleton that owns all PasswordStores and associates them with |
| 47 // Profiles. | 47 // Profiles. |
| 48 class PasswordStoreFactory : public BrowserContextKeyedServiceFactory { | 48 class PasswordStoreFactory : public BrowserContextKeyedServiceFactory { |
| 49 public: | 49 public: |
| 50 static scoped_refptr<password_manager::PasswordStore> GetForProfile( | 50 static scoped_refptr<password_manager::PasswordStore> GetForProfile( |
| 51 Profile* profile, | 51 Profile* profile, |
| 52 Profile::ServiceAccessType set); | 52 Profile::ServiceAccessType set); |
| 53 | 53 |
| 54 static PasswordStoreFactory* GetInstance(); | 54 static PasswordStoreFactory* GetInstance(); |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 friend struct DefaultSingletonTraits<PasswordStoreFactory>; | 57 friend struct DefaultSingletonTraits<PasswordStoreFactory>; |
| 58 | 58 |
| 59 PasswordStoreFactory(); | 59 PasswordStoreFactory(); |
| 60 virtual ~PasswordStoreFactory(); | 60 virtual ~PasswordStoreFactory(); |
| 61 | 61 |
| 62 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && defined(OS_POSIX) | 62 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && defined(OS_POSIX) |
| 63 LocalProfileId GetLocalProfileId(PrefService* prefs) const; | 63 LocalProfileId GetLocalProfileId(PrefService* prefs) const; |
| 64 #endif | 64 #endif |
| 65 | 65 |
| 66 // BrowserContextKeyedServiceFactory: | 66 // BrowserContextKeyedServiceFactory: |
| 67 virtual KeyedService* BuildServiceInstanceFor( | 67 virtual KeyedService* BuildServiceInstanceFor( |
| 68 content::BrowserContext* context) const OVERRIDE; | 68 content::BrowserContext* context) const override; |
| 69 virtual void RegisterProfilePrefs( | 69 virtual void RegisterProfilePrefs( |
| 70 user_prefs::PrefRegistrySyncable* registry) OVERRIDE; | 70 user_prefs::PrefRegistrySyncable* registry) override; |
| 71 virtual content::BrowserContext* GetBrowserContextToUse( | 71 virtual content::BrowserContext* GetBrowserContextToUse( |
| 72 content::BrowserContext* context) const OVERRIDE; | 72 content::BrowserContext* context) const override; |
| 73 virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; | 73 virtual bool ServiceIsNULLWhileTesting() const override; |
| 74 | 74 |
| 75 DISALLOW_COPY_AND_ASSIGN(PasswordStoreFactory); | 75 DISALLOW_COPY_AND_ASSIGN(PasswordStoreFactory); |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_FACTORY_H_ | 78 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_FACTORY_H_ |
| OLD | NEW |