cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / ios / chrome / browser / web_data_service_factory.h
blob61a8d0a7c024ac3800e58861847a0871f1bd6c3b
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 template <typename T>
14 struct DefaultSingletonTraits;
15 class KeywordWebDataService;
16 class TokenWebData;
17 class WebDataServiceWrapper;
18 enum class ServiceAccessType;
20 namespace autofill {
21 class AutofillWebDataService;
24 namespace ios {
26 class ChromeBrowserState;
28 // Singleton that owns all WebDataServiceWrappers and associates them with
29 // ios::ChromeBrowserState.
30 class WebDataServiceFactory : public BrowserStateKeyedServiceFactory {
31 public:
32 // Returns the AutofillWebDataService associated with |browser_state|.
33 static WebDataServiceWrapper* GetForBrowserState(
34 ios::ChromeBrowserState* browser_state,
35 ServiceAccessType access_type);
36 static WebDataServiceWrapper* GetForBrowserStateIfExists(
37 ios::ChromeBrowserState* browser_state,
38 ServiceAccessType access_type);
40 // Returns the AutofillWebDataService associated with |browser_state|.
41 static scoped_refptr<autofill::AutofillWebDataService>
42 GetAutofillWebDataForBrowserState(ios::ChromeBrowserState* browser_state,
43 ServiceAccessType access_type);
45 // Returns the KeywordWebDataService associated with |browser_state|.
46 static scoped_refptr<KeywordWebDataService> GetKeywordWebDataForBrowserState(
47 ios::ChromeBrowserState* browser_state,
48 ServiceAccessType access_type);
50 // Returns the TokenWebData associated with |browser_state|.
51 static scoped_refptr<TokenWebData> GetTokenWebDataForBrowserState(
52 ios::ChromeBrowserState* browser_state,
53 ServiceAccessType access_type);
55 static WebDataServiceFactory* GetInstance();
57 private:
58 friend struct DefaultSingletonTraits<WebDataServiceFactory>;
60 WebDataServiceFactory();
61 ~WebDataServiceFactory() override;
63 // BrowserStateKeyedServiceFactory implementation.
64 scoped_ptr<KeyedService> BuildServiceInstanceFor(
65 web::BrowserState* context) const override;
66 web::BrowserState* GetBrowserStateToUse(
67 web::BrowserState* context) const override;
68 bool ServiceIsNULLWhileTesting() const override;
70 DISALLOW_COPY_AND_ASSIGN(WebDataServiceFactory);
73 } // namespace ios
75 #endif // IOS_CHROME_BROWSER_WEB_DATA_SERVICE_FACTORY_H_