blob: 6a5575bad8f26905ede2fd18eb4145c465ccdd5b [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
gogerald79472092017-04-27 15:38:1624namespace payments {
25class PaymentManifestWebDataService;
26}
gogerald79472092017-04-27 15:38:1627
[email protected]e217c5632013-04-12 19:11:4828namespace autofill {
29class AutofillWebDataService;
sdefresnee9ea3c22015-01-10 10:10:0430}
[email protected]e217c5632013-04-12 19:11:4831
[email protected]78f1d9b2013-03-20 09:43:1832// Singleton that owns all WebDataServiceWrappers and associates them with
33// Profiles.
[email protected]f1484c52013-05-22 23:25:4434class WebDataServiceFactory : public BrowserContextKeyedServiceFactory {
[email protected]d07edd42012-05-14 23:49:4635 public:
[email protected]34b59462013-12-03 14:08:3236 // Returns the WebDataServiceWrapper associated with the |profile|.
sdefresnee9ea3c22015-01-10 10:10:0437 static WebDataServiceWrapper* GetForProfile(Profile* profile,
38 ServiceAccessType access_type);
[email protected]d07edd42012-05-14 23:49:4639
[email protected]e2b31052013-03-25 01:49:3740 static WebDataServiceWrapper* GetForProfileIfExists(
[email protected]34b59462013-12-03 14:08:3241 Profile* profile,
sdefresnee9ea3c22015-01-10 10:10:0442 ServiceAccessType access_type);
[email protected]34b59462013-12-03 14:08:3243
44 // Returns the AutofillWebDataService associated with the |profile|.
45 static scoped_refptr<autofill::AutofillWebDataService>
sdefresnee9ea3c22015-01-10 10:10:0446 GetAutofillWebDataForProfile(Profile* profile, ServiceAccessType access_type);
[email protected]dd3c53f2013-03-14 02:59:4147
Florian Uunk75c22c92018-06-25 12:44:1048 // Returns the account-scoped AutofillWebDataService associated with the
49 // |profile|.
50 static scoped_refptr<autofill::AutofillWebDataService>
51 GetAutofillWebDataForAccount(Profile* profile, ServiceAccessType access_type);
52
[email protected]37b324602014-07-02 07:30:4953 // Returns the KeywordWebDataService associated with the |profile|.
[email protected]bd386e62014-07-09 22:17:0654 static scoped_refptr<KeywordWebDataService> GetKeywordWebDataForProfile(
55 Profile* profile,
sdefresnee9ea3c22015-01-10 10:10:0456 ServiceAccessType access_type);
[email protected]37b324602014-07-02 07:30:4957
[email protected]1be4efd2014-01-09 12:43:4458 // Returns the TokenWebData associated with the |profile|.
[email protected]bd386e62014-07-09 22:17:0659 static scoped_refptr<TokenWebData> GetTokenWebDataForProfile(
60 Profile* profile,
sdefresnee9ea3c22015-01-10 10:10:0461 ServiceAccessType access_type);
[email protected]1be4efd2014-01-09 12:43:4462
gogerald79472092017-04-27 15:38:1663 static scoped_refptr<payments::PaymentManifestWebDataService>
64 GetPaymentManifestWebDataForProfile(Profile* profile,
65 ServiceAccessType access_type);
gogerald79472092017-04-27 15:38:1666
[email protected]d07edd42012-05-14 23:49:4667 static WebDataServiceFactory* GetInstance();
68
69 private:
olli.raula36aa8be2015-09-10 11:14:2270 friend struct base::DefaultSingletonTraits<WebDataServiceFactory>;
[email protected]d07edd42012-05-14 23:49:4671
72 WebDataServiceFactory();
Daniel Chenga542fca2014-10-21 09:51:2973 ~WebDataServiceFactory() override;
[email protected]d07edd42012-05-14 23:49:4674
Henrique Nakashima97451242019-04-29 16:14:2875 // |BrowserContextKeyedServiceFactory| methods:
Daniel Chenga542fca2014-10-21 09:51:2976 content::BrowserContext* GetBrowserContextToUse(
mostynbfb66cb4f2014-10-07 09:15:4277 content::BrowserContext* context) const override;
Daniel Chenga542fca2014-10-21 09:51:2978 KeyedService* BuildServiceInstanceFor(
mostynbfb66cb4f2014-10-07 09:15:4279 content::BrowserContext* profile) const override;
Daniel Chenga542fca2014-10-21 09:51:2980 bool ServiceIsNULLWhileTesting() const override;
[email protected]78f1d9b2013-03-20 09:43:1881
82 DISALLOW_COPY_AND_ASSIGN(WebDataServiceFactory);
[email protected]d07edd42012-05-14 23:49:4683};
84
tfarinabf215a6f2015-06-15 22:24:0585#endif // CHROME_BROWSER_WEB_DATA_SERVICE_FACTORY_H_