/chrome/browser/web_data_service_factory.h

https://gitlab.com/jonnialva90/iridium-browser · C Header · 81 lines · 52 code · 18 blank · 11 comment · 0 complexity · 35b370b79f5d51863bcdb3649b4b57a9 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_WEB_DATA_SERVICE_FACTORY_H_
  5. #define CHROME_BROWSER_WEB_DATA_SERVICE_FACTORY_H_
  6. #include "base/macros.h"
  7. #include "base/memory/ref_counted.h"
  8. #include "components/keyed_service/content/browser_context_keyed_service_factory.h"
  9. #include "components/keyed_service/core/service_access_type.h"
  10. namespace base {
  11. template <typename T> struct DefaultSingletonTraits;
  12. }
  13. class KeywordWebDataService;
  14. class Profile;
  15. class TokenWebData;
  16. class WebDataServiceWrapper;
  17. #if defined(OS_WIN)
  18. class PasswordWebDataService;
  19. #endif
  20. namespace autofill {
  21. class AutofillWebDataService;
  22. }
  23. // Singleton that owns all WebDataServiceWrappers and associates them with
  24. // Profiles.
  25. class WebDataServiceFactory : public BrowserContextKeyedServiceFactory {
  26. public:
  27. // Returns the WebDataServiceWrapper associated with the |profile|.
  28. static WebDataServiceWrapper* GetForProfile(Profile* profile,
  29. ServiceAccessType access_type);
  30. static WebDataServiceWrapper* GetForProfileIfExists(
  31. Profile* profile,
  32. ServiceAccessType access_type);
  33. // Returns the AutofillWebDataService associated with the |profile|.
  34. static scoped_refptr<autofill::AutofillWebDataService>
  35. GetAutofillWebDataForProfile(Profile* profile, ServiceAccessType access_type);
  36. // Returns the KeywordWebDataService associated with the |profile|.
  37. static scoped_refptr<KeywordWebDataService> GetKeywordWebDataForProfile(
  38. Profile* profile,
  39. ServiceAccessType access_type);
  40. // Returns the TokenWebData associated with the |profile|.
  41. static scoped_refptr<TokenWebData> GetTokenWebDataForProfile(
  42. Profile* profile,
  43. ServiceAccessType access_type);
  44. #if defined(OS_WIN)
  45. // Returns the PasswordWebDataService associated with the |profile|.
  46. static scoped_refptr<PasswordWebDataService> GetPasswordWebDataForProfile(
  47. Profile* profile,
  48. ServiceAccessType access_type);
  49. #endif
  50. static WebDataServiceFactory* GetInstance();
  51. private:
  52. friend struct base::DefaultSingletonTraits<WebDataServiceFactory>;
  53. WebDataServiceFactory();
  54. ~WebDataServiceFactory() override;
  55. // |BrowserContextKeyedBaseFactory| methods:
  56. content::BrowserContext* GetBrowserContextToUse(
  57. content::BrowserContext* context) const override;
  58. KeyedService* BuildServiceInstanceFor(
  59. content::BrowserContext* profile) const override;
  60. bool ServiceIsNULLWhileTesting() const override;
  61. DISALLOW_COPY_AND_ASSIGN(WebDataServiceFactory);
  62. };
  63. #endif // CHROME_BROWSER_WEB_DATA_SERVICE_FACTORY_H_