Move AppMenuTest from ChromeShellTest to ChromePublicTest
[chromium-blink-merge.git] / chrome / browser / web_data_service_factory.h
blob23565ebc0bbf19ccb0d3763d2b796c5435d3540e
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 template <typename T> struct DefaultSingletonTraits;
14 class KeywordWebDataService;
15 class Profile;
16 class TokenWebData;
17 class WebDataServiceWrapper;
19 #if defined(OS_WIN)
20 class PasswordWebDataService;
21 #endif
23 namespace autofill {
24 class AutofillWebDataService;
27 // Singleton that owns all WebDataServiceWrappers and associates them with
28 // Profiles.
29 class WebDataServiceFactory : public BrowserContextKeyedServiceFactory {
30 public:
31 // Returns the WebDataServiceWrapper associated with the |profile|.
32 static WebDataServiceWrapper* GetForProfile(Profile* profile,
33 ServiceAccessType access_type);
35 static WebDataServiceWrapper* GetForProfileIfExists(
36 Profile* profile,
37 ServiceAccessType access_type);
39 // Returns the AutofillWebDataService associated with the |profile|.
40 static scoped_refptr<autofill::AutofillWebDataService>
41 GetAutofillWebDataForProfile(Profile* profile, ServiceAccessType access_type);
43 // Returns the KeywordWebDataService associated with the |profile|.
44 static scoped_refptr<KeywordWebDataService> GetKeywordWebDataForProfile(
45 Profile* profile,
46 ServiceAccessType access_type);
48 // Returns the TokenWebData associated with the |profile|.
49 static scoped_refptr<TokenWebData> GetTokenWebDataForProfile(
50 Profile* profile,
51 ServiceAccessType access_type);
53 #if defined(OS_WIN)
54 // Returns the PasswordWebDataService associated with the |profile|.
55 static scoped_refptr<PasswordWebDataService> GetPasswordWebDataForProfile(
56 Profile* profile,
57 ServiceAccessType access_type);
58 #endif
60 static WebDataServiceFactory* GetInstance();
62 private:
63 friend struct DefaultSingletonTraits<WebDataServiceFactory>;
65 WebDataServiceFactory();
66 ~WebDataServiceFactory() override;
68 // |BrowserContextKeyedBaseFactory| methods:
69 content::BrowserContext* GetBrowserContextToUse(
70 content::BrowserContext* context) const override;
71 KeyedService* BuildServiceInstanceFor(
72 content::BrowserContext* profile) const override;
73 bool ServiceIsNULLWhileTesting() const override;
75 DISALLOW_COPY_AND_ASSIGN(WebDataServiceFactory);
78 #endif // CHROME_BROWSER_WEB_DATA_SERVICE_FACTORY_H_