blob: 60b78000862f2d8e4faa9bf01e32d56bb6cea015 [file] [log] [blame]
[email protected]d07edd42012-05-14 23:49:461// 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
tfarinabf215a6f2015-06-15 22:24:055#ifndef CHROME_BROWSER_WEB_DATA_SERVICE_FACTORY_H_
6#define CHROME_BROWSER_WEB_DATA_SERVICE_FACTORY_H_
[email protected]d07edd42012-05-14 23:49:467
sdefresnee9ea3c22015-01-10 10:10:048#include "base/macros.h"
[email protected]78f1d9b2013-03-20 09:43:189#include "base/memory/ref_counted.h"
avi664c07b2015-12-26 02:18:3110#include "build/build_config.h"
[email protected]540380fc2014-03-14 10:10:3411#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
sdefresnee9ea3c22015-01-10 10:10:0412#include "components/keyed_service/core/service_access_type.h"
[email protected]e2b31052013-03-25 01:49:3713
olli.raula36aa8be2015-09-10 11:14:2214namespace base {
Rouslan Solomakhinde012532017-09-20 15:18:3415template <typename T>
16struct DefaultSingletonTraits;
olli.raula36aa8be2015-09-10 11:14:2217}
18
[email protected]37b324602014-07-02 07:30:4919class KeywordWebDataService;
sdefresnee9ea3c22015-01-10 10:10:0420class Profile;
[email protected]b69d6312013-05-27 21:07:3621class TokenWebData;
sdefresnecb955cd2014-12-15 23:21:5622class WebDataServiceWrapper;
[email protected]bd386e62014-07-09 22:17:0623
24#if defined(OS_WIN)
25class PasswordWebDataService;
26#endif
[email protected]d07edd42012-05-14 23:49:4627
gogerald79472092017-04-27 15:38:1628namespace payments {
29class PaymentManifestWebDataService;
30}
gogerald79472092017-04-27 15:38:1631
[email protected]e217c5632013-04-12 19:11:4832namespace autofill {
33class AutofillWebDataService;
sdefresnee9ea3c22015-01-10 10:10:0434}
[email protected]e217c5632013-04-12 19:11:4835
[email protected]78f1d9b2013-03-20 09:43:1836// Singleton that owns all WebDataServiceWrappers and associates them with
37// Profiles.
[email protected]f1484c52013-05-22 23:25:4438class WebDataServiceFactory : public BrowserContextKeyedServiceFactory {
[email protected]d07edd42012-05-14 23:49:4639 public:
[email protected]34b59462013-12-03 14:08:3240 // Returns the WebDataServiceWrapper associated with the |profile|.
sdefresnee9ea3c22015-01-10 10:10:0441 static WebDataServiceWrapper* GetForProfile(Profile* profile,
42 ServiceAccessType access_type);
[email protected]d07edd42012-05-14 23:49:4643
[email protected]e2b31052013-03-25 01:49:3744 static WebDataServiceWrapper* GetForProfileIfExists(
[email protected]34b59462013-12-03 14:08:3245 Profile* profile,
sdefresnee9ea3c22015-01-10 10:10:0446 ServiceAccessType access_type);
[email protected]34b59462013-12-03 14:08:3247
48 // Returns the AutofillWebDataService associated with the |profile|.
49 static scoped_refptr<autofill::AutofillWebDataService>
sdefresnee9ea3c22015-01-10 10:10:0450 GetAutofillWebDataForProfile(Profile* profile, ServiceAccessType access_type);
[email protected]dd3c53f2013-03-14 02:59:4151
[email protected]37b324602014-07-02 07:30:4952 // Returns the KeywordWebDataService associated with the |profile|.
[email protected]bd386e62014-07-09 22:17:0653 static scoped_refptr<KeywordWebDataService> GetKeywordWebDataForProfile(
54 Profile* profile,
sdefresnee9ea3c22015-01-10 10:10:0455 ServiceAccessType access_type);
[email protected]37b324602014-07-02 07:30:4956
[email protected]1be4efd2014-01-09 12:43:4457 // Returns the TokenWebData associated with the |profile|.
[email protected]bd386e62014-07-09 22:17:0658 static scoped_refptr<TokenWebData> GetTokenWebDataForProfile(
59 Profile* profile,
sdefresnee9ea3c22015-01-10 10:10:0460 ServiceAccessType access_type);
[email protected]1be4efd2014-01-09 12:43:4461
[email protected]bd386e62014-07-09 22:17:0662#if defined(OS_WIN)
63 // Returns the PasswordWebDataService associated with the |profile|.
64 static scoped_refptr<PasswordWebDataService> GetPasswordWebDataForProfile(
65 Profile* profile,
sdefresnee9ea3c22015-01-10 10:10:0466 ServiceAccessType access_type);
[email protected]bd386e62014-07-09 22:17:0667#endif
68
gogerald79472092017-04-27 15:38:1669 static scoped_refptr<payments::PaymentManifestWebDataService>
70 GetPaymentManifestWebDataForProfile(Profile* profile,
71 ServiceAccessType access_type);
gogerald79472092017-04-27 15:38:1672
[email protected]d07edd42012-05-14 23:49:4673 static WebDataServiceFactory* GetInstance();
74
75 private:
olli.raula36aa8be2015-09-10 11:14:2276 friend struct base::DefaultSingletonTraits<WebDataServiceFactory>;
[email protected]d07edd42012-05-14 23:49:4677
78 WebDataServiceFactory();
Daniel Chenga542fca2014-10-21 09:51:2979 ~WebDataServiceFactory() override;
[email protected]d07edd42012-05-14 23:49:4680
[email protected]f1484c52013-05-22 23:25:4481 // |BrowserContextKeyedBaseFactory| methods:
Daniel Chenga542fca2014-10-21 09:51:2982 content::BrowserContext* GetBrowserContextToUse(
mostynbfb66cb4f2014-10-07 09:15:4283 content::BrowserContext* context) const override;
Daniel Chenga542fca2014-10-21 09:51:2984 KeyedService* BuildServiceInstanceFor(
mostynbfb66cb4f2014-10-07 09:15:4285 content::BrowserContext* profile) const override;
Daniel Chenga542fca2014-10-21 09:51:2986 bool ServiceIsNULLWhileTesting() const override;
[email protected]78f1d9b2013-03-20 09:43:1887
88 DISALLOW_COPY_AND_ASSIGN(WebDataServiceFactory);
[email protected]d07edd42012-05-14 23:49:4689};
90
tfarinabf215a6f2015-06-15 22:24:0591#endif // CHROME_BROWSER_WEB_DATA_SERVICE_FACTORY_H_