MD Downloads: UI review feedback
[chromium-blink-merge.git] / chrome / browser / web_data_service_factory.h
blobd1b5608126275137c31d50b6d6eb5edae0890cb8
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.
5 #ifndef CHROME_BROWSER_WEB_DATA_SERVICE_FACTORY_H_
6 #define CHROME_BROWSER_WEB_DATA_SERVICE_FACTORY_H_
8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "components/keyed_service/content/browser_context_keyed_service_factory.h"
11 #include "components/keyed_service/core/service_access_type.h"
13 namespace base {
14 template <typename T> struct DefaultSingletonTraits;
17 class KeywordWebDataService;
18 class Profile;
19 class TokenWebData;
20 class WebDataServiceWrapper;
22 #if defined(OS_WIN)
23 class PasswordWebDataService;
24 #endif
26 namespace autofill {
27 class AutofillWebDataService;
30 // Singleton that owns all WebDataServiceWrappers and associates them with
31 // Profiles.
32 class WebDataServiceFactory : public BrowserContextKeyedServiceFactory {
33 public:
34 // Returns the WebDataServiceWrapper associated with the |profile|.
35 static WebDataServiceWrapper* GetForProfile(Profile* profile,
36 ServiceAccessType access_type);
38 static WebDataServiceWrapper* GetForProfileIfExists(
39 Profile* profile,
40 ServiceAccessType access_type);
42 // Returns the AutofillWebDataService associated with the |profile|.
43 static scoped_refptr<autofill::AutofillWebDataService>
44 GetAutofillWebDataForProfile(Profile* profile, ServiceAccessType access_type);
46 // Returns the KeywordWebDataService associated with the |profile|.
47 static scoped_refptr<KeywordWebDataService> GetKeywordWebDataForProfile(
48 Profile* profile,
49 ServiceAccessType access_type);
51 // Returns the TokenWebData associated with the |profile|.
52 static scoped_refptr<TokenWebData> GetTokenWebDataForProfile(
53 Profile* profile,
54 ServiceAccessType access_type);
56 #if defined(OS_WIN)
57 // Returns the PasswordWebDataService associated with the |profile|.
58 static scoped_refptr<PasswordWebDataService> GetPasswordWebDataForProfile(
59 Profile* profile,
60 ServiceAccessType access_type);
61 #endif
63 static WebDataServiceFactory* GetInstance();
65 private:
66 friend struct base::DefaultSingletonTraits<WebDataServiceFactory>;
68 WebDataServiceFactory();
69 ~WebDataServiceFactory() override;
71 // |BrowserContextKeyedBaseFactory| methods:
72 content::BrowserContext* GetBrowserContextToUse(
73 content::BrowserContext* context) const override;
74 KeyedService* BuildServiceInstanceFor(
75 content::BrowserContext* profile) const override;
76 bool ServiceIsNULLWhileTesting() const override;
78 DISALLOW_COPY_AND_ASSIGN(WebDataServiceFactory);
81 #endif // CHROME_BROWSER_WEB_DATA_SERVICE_FACTORY_H_