Implements TemplateURLServiceFactory on iOS
[chromium-blink-merge.git] / ios / public / provider / chrome / browser / chrome_browser_provider.h
blob7897e6a62cf9309965e45301291efcab3fe56106
1 // Copyright 2013 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_PUBLIC_PROVIDER_CHROME_BROWSER_CHROME_BROWSER_PROVIDER_H_
6 #define IOS_PUBLIC_PROVIDER_CHROME_BROWSER_CHROME_BROWSER_PROVIDER_H_
8 #include <CoreGraphics/CoreGraphics.h>
10 #include <string>
12 class InfoBarViewDelegate;
13 class PrefService;
14 class ProfileOAuth2TokenServiceIOSProvider;
16 namespace autofill {
17 class CardUnmaskPromptController;
18 class CardUnmaskPromptView;
21 namespace metrics {
22 class MetricsService;
25 namespace net {
26 class URLRequestContextGetter;
29 namespace rappor {
30 class RapporService;
33 // TODO(ios): Determine the best way to interface with Obj-C code through
34 // the ChromeBrowserProvider. crbug/298181
35 #ifdef __OBJC__
36 @class UIView;
37 @protocol InfoBarViewProtocol;
38 typedef UIView<InfoBarViewProtocol>* InfoBarViewPlaceholder;
39 #else
40 class InfoBarViewPlaceholderClass;
41 typedef InfoBarViewPlaceholderClass* InfoBarViewPlaceholder;
42 class UIView;
43 #endif
45 namespace ios {
47 class ChromeBrowserProvider;
48 class ChromeBrowserStateManager;
49 class GeolocationUpdaterProvider;
50 class SearchProvider;
51 class StringProvider;
52 class UpdatableResourceProvider;
54 // Setter and getter for the provider. The provider should be set early, before
55 // any browser code is called.
56 void SetChromeBrowserProvider(ChromeBrowserProvider* provider);
57 ChromeBrowserProvider* GetChromeBrowserProvider();
59 // A class that allows embedding iOS-specific functionality in the
60 // ios_chrome_browser target.
61 class ChromeBrowserProvider {
62 public:
63 ChromeBrowserProvider();
64 virtual ~ChromeBrowserProvider();
66 // Gets the system URL request context.
67 virtual net::URLRequestContextGetter* GetSystemURLRequestContext();
68 // Gets the local state.
69 virtual PrefService* GetLocalState();
70 // Returns an instance of profile OAuth2 token service provider.
71 virtual ProfileOAuth2TokenServiceIOSProvider*
72 GetProfileOAuth2TokenServiceIOSProvider();
73 // Returns an UpdatableResourceProvider instance.
74 virtual UpdatableResourceProvider* GetUpdatableResourceProvider();
75 // Returns a ChromeBrowserStateManager instance.
76 virtual ChromeBrowserStateManager* GetChromeBrowserStateManager();
77 // Returns an infobar view conforming to the InfoBarViewProtocol. The returned
78 // object is retained.
79 virtual InfoBarViewPlaceholder CreateInfoBarView(
80 CGRect frame,
81 InfoBarViewDelegate* delegate);
82 // Returns an instance of a string provider.
83 virtual StringProvider* GetStringProvider();
84 virtual GeolocationUpdaterProvider* GetGeolocationUpdaterProvider();
85 // Displays the Translate settings screen.
86 virtual void ShowTranslateSettings();
87 // Returns the distribution brand code.
88 virtual std::string GetDistributionBrandCode();
89 // Returns whether the new bookmark collection experience is enabled.
90 virtual bool IsBookmarkCollectionEnabled();
91 // Returns the chrome UI scheme.
92 // TODO(droger): Remove this method once chrome no longer needs to match
93 // content.
94 virtual const char* GetChromeUIScheme();
95 // Sets the alpha property of an UIView with an animation.
96 virtual void SetUIViewAlphaWithAnimation(UIView* view, float alpha);
97 // Returns the metrics service.
98 virtual metrics::MetricsService* GetMetricsService();
99 // Returns an instance of a CardUnmaskPromptView used to unmask Wallet cards.
100 // The view is responsible for its own lifetime.
101 virtual autofill::CardUnmaskPromptView* CreateCardUnmaskPromptView(
102 autofill::CardUnmaskPromptController* controller);
103 // Returns risk data used in Wallet requests.
104 virtual std::string GetRiskData();
105 // Returns product version with prefix.
106 virtual std::string GetProductVersionWithPrefix(const std::string& prefix);
107 // Returns a version string to be displayed in "About Chromium" dialog.
108 virtual std::string GetVersionString();
109 // Version number, e.g. "6.0.490.1".
110 virtual std::string GetVersionNumber();
111 // Returns the RapporService. May be null.
112 virtual rappor::RapporService* GetRapporService();
113 // Returns the SearchProvider.
114 virtual SearchProvider* GetSearchProvider();
117 } // namespace ios
119 #endif // IOS_PUBLIC_PROVIDER_CHROME_BROWSER_CHROME_BROWSER_PROVIDER_H_