roll libyuv from 1483 to 1487
[chromium-blink-merge.git] / ios / chrome / browser / web_data_service_factory.h
blobfee7432c3cfb2f1545b4a1d31d1beca81d802d1c
1 // Copyright 2015 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 IOS_CHROME_BROWSER_WEB_DATA_SERVICE_FACTORY_H_
6 #define IOS_CHROME_BROWSER_WEB_DATA_SERVICE_FACTORY_H_
8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "components/keyed_service/ios/browser_state_keyed_service_factory.h"
13 namespace base {
14 template <typename T>
15 struct DefaultSingletonTraits;
16 } // namespace base
18 class KeywordWebDataService;
19 class TokenWebData;
20 class WebDataServiceWrapper;
21 enum class ServiceAccessType;
23 namespace autofill {
24 class AutofillWebDataService;
27 namespace ios {
29 class ChromeBrowserState;
31 // Singleton that owns all WebDataServiceWrappers and associates them with
32 // ios::ChromeBrowserState.
33 class WebDataServiceFactory : public BrowserStateKeyedServiceFactory {
34 public:
35 // Returns the AutofillWebDataService associated with |browser_state|.
36 static WebDataServiceWrapper* GetForBrowserState(
37 ios::ChromeBrowserState* browser_state,
38 ServiceAccessType access_type);
39 static WebDataServiceWrapper* GetForBrowserStateIfExists(
40 ios::ChromeBrowserState* browser_state,
41 ServiceAccessType access_type);
43 // Returns the AutofillWebDataService associated with |browser_state|.
44 static scoped_refptr<autofill::AutofillWebDataService>
45 GetAutofillWebDataForBrowserState(ios::ChromeBrowserState* browser_state,
46 ServiceAccessType access_type);
48 // Returns the KeywordWebDataService associated with |browser_state|.
49 static scoped_refptr<KeywordWebDataService> GetKeywordWebDataForBrowserState(
50 ios::ChromeBrowserState* browser_state,
51 ServiceAccessType access_type);
53 // Returns the TokenWebData associated with |browser_state|.
54 static scoped_refptr<TokenWebData> GetTokenWebDataForBrowserState(
55 ios::ChromeBrowserState* browser_state,
56 ServiceAccessType access_type);
58 static WebDataServiceFactory* GetInstance();
60 private:
61 friend struct base::DefaultSingletonTraits<WebDataServiceFactory>;
63 WebDataServiceFactory();
64 ~WebDataServiceFactory() override;
66 // BrowserStateKeyedServiceFactory implementation.
67 scoped_ptr<KeyedService> BuildServiceInstanceFor(
68 web::BrowserState* context) const override;
69 web::BrowserState* GetBrowserStateToUse(
70 web::BrowserState* context) const override;
71 bool ServiceIsNULLWhileTesting() const override;
73 DISALLOW_COPY_AND_ASSIGN(WebDataServiceFactory);
76 } // namespace ios
78 #endif // IOS_CHROME_BROWSER_WEB_DATA_SERVICE_FACTORY_H_