/chromium-webcl/src/chrome/browser/password_manager/password_store_factory.h

https://bitbucket.org/peixuan/chromium_r197479_base · C Header · 55 lines · 32 code · 12 blank · 11 comment · 4 complexity · 662327c125a18752f04d57985d3188e2 MD5 · raw file

  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
  3. // found in the LICENSE file.
  4. #ifndef CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_FACTORY_H_
  5. #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_FACTORY_H_
  6. #include "base/basictypes.h"
  7. #include "base/memory/singleton.h"
  8. #include "chrome/browser/profiles/profile.h"
  9. #include "chrome/browser/profiles/refcounted_profile_keyed_service_factory.h"
  10. class PasswordStore;
  11. class PrefRegistrySyncable;
  12. class Profile;
  13. #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && defined(OS_POSIX)
  14. // Local profile ids are used to associate resources stored outside the profile
  15. // directory, like saved passwords in GNOME Keyring / KWallet, with a profile.
  16. // With high probability, they are unique on the local machine. They are almost
  17. // certainly not unique globally, by design. Do not send them over the network.
  18. typedef int LocalProfileId;
  19. #endif
  20. // Singleton that owns all PasswordStores and associates them with
  21. // Profiles. Listens for the Profile's destruction notification and cleans up
  22. // the associated PasswordStore.
  23. class PasswordStoreFactory : public RefcountedProfileKeyedServiceFactory {
  24. public:
  25. static scoped_refptr<PasswordStore> GetForProfile(
  26. Profile* profile, Profile::ServiceAccessType set);
  27. static PasswordStoreFactory* GetInstance();
  28. private:
  29. friend struct DefaultSingletonTraits<PasswordStoreFactory>;
  30. PasswordStoreFactory();
  31. virtual ~PasswordStoreFactory();
  32. #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && defined(OS_POSIX)
  33. LocalProfileId GetLocalProfileId(PrefService* prefs) const;
  34. #endif
  35. // ProfileKeyedServiceFactory:
  36. virtual scoped_refptr<RefcountedProfileKeyedService> BuildServiceInstanceFor(
  37. content::BrowserContext* context) const OVERRIDE;
  38. virtual void RegisterUserPrefs(PrefRegistrySyncable* registry) OVERRIDE;
  39. virtual bool ServiceRedirectedInIncognito() const OVERRIDE;
  40. virtual bool ServiceIsNULLWhileTesting() const OVERRIDE;
  41. DISALLOW_COPY_AND_ASSIGN(PasswordStoreFactory);
  42. };
  43. #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_FACTORY_H_