Add a minor text member to ui::MenuModel.
[chromium-blink-merge.git] / chrome / browser / chrome_content_browser_client.h
blobfbe28f86032da7c5c5954d01416bc091f8ddd095
1 // 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.
5 #ifndef CHROME_BROWSER_CHROME_CONTENT_BROWSER_CLIENT_H_
6 #define CHROME_BROWSER_CHROME_CONTENT_BROWSER_CLIENT_H_
8 #include <set>
9 #include <string>
10 #include <utility>
11 #include <vector>
13 #include "base/compiler_specific.h"
14 #include "content/public/browser/content_browser_client.h"
16 #if defined(OS_ANDROID)
17 #include "base/memory/scoped_ptr.h"
18 #endif
20 namespace content {
21 class QuotaPermissionContext;
24 namespace extensions {
25 class BrowserPermissionsPolicyDelegate;
28 namespace user_prefs {
29 class PrefRegistrySyncable;
32 namespace chrome {
34 class ChromeContentBrowserClient : public content::ContentBrowserClient {
35 public:
36 ChromeContentBrowserClient();
37 virtual ~ChromeContentBrowserClient();
39 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
41 // Notification that the application locale has changed. This allows us to
42 // update our I/O thread cache of this value.
43 static void SetApplicationLocale(const std::string& locale);
45 virtual content::BrowserMainParts* CreateBrowserMainParts(
46 const content::MainFunctionParams& parameters) OVERRIDE;
47 virtual std::string GetStoragePartitionIdForSite(
48 content::BrowserContext* browser_context,
49 const GURL& site) OVERRIDE;
50 virtual bool IsValidStoragePartitionId(
51 content::BrowserContext* browser_context,
52 const std::string& partition_id) OVERRIDE;
53 virtual void GetStoragePartitionConfigForSite(
54 content::BrowserContext* browser_context,
55 const GURL& site,
56 bool can_be_default,
57 std::string* partition_domain,
58 std::string* partition_name,
59 bool* in_memory) OVERRIDE;
60 virtual content::WebContentsViewDelegate* GetWebContentsViewDelegate(
61 content::WebContents* web_contents) OVERRIDE;
62 virtual void GuestWebContentsCreated(
63 content::WebContents* guest_web_contents,
64 content::WebContents* opener_web_contents,
65 content::BrowserPluginGuestDelegate** guest_delegate,
66 scoped_ptr<base::DictionaryValue> extra_params) OVERRIDE;
67 virtual void GuestWebContentsAttached(
68 content::WebContents* guest_web_contents,
69 content::WebContents* embedder_web_contents,
70 const base::DictionaryValue& extra_params) OVERRIDE;
71 virtual void RenderProcessHostCreated(
72 content::RenderProcessHost* host) OVERRIDE;
73 virtual bool ShouldUseProcessPerSite(content::BrowserContext* browser_context,
74 const GURL& effective_url) OVERRIDE;
75 virtual GURL GetEffectiveURL(content::BrowserContext* browser_context,
76 const GURL& url) OVERRIDE;
77 virtual void GetAdditionalWebUISchemes(
78 std::vector<std::string>* additional_schemes) OVERRIDE;
79 virtual net::URLRequestContextGetter* CreateRequestContext(
80 content::BrowserContext* browser_context,
81 content::ProtocolHandlerMap* protocol_handlers) OVERRIDE;
82 virtual net::URLRequestContextGetter* CreateRequestContextForStoragePartition(
83 content::BrowserContext* browser_context,
84 const base::FilePath& partition_path,
85 bool in_memory,
86 content::ProtocolHandlerMap* protocol_handlers) OVERRIDE;
87 virtual bool IsHandledURL(const GURL& url) OVERRIDE;
88 virtual bool CanCommitURL(content::RenderProcessHost* process_host,
89 const GURL& url) OVERRIDE;
90 virtual bool IsSuitableHost(content::RenderProcessHost* process_host,
91 const GURL& site_url) OVERRIDE;
92 virtual bool ShouldTryToUseExistingProcessHost(
93 content::BrowserContext* browser_context, const GURL& url) OVERRIDE;
94 virtual void SiteInstanceGotProcess(
95 content::SiteInstance* site_instance) OVERRIDE;
96 virtual void SiteInstanceDeleting(content::SiteInstance* site_instance)
97 OVERRIDE;
98 virtual bool ShouldSwapProcessesForNavigation(
99 content::SiteInstance* site_instance,
100 const GURL& current_url,
101 const GURL& new_url) OVERRIDE;
102 virtual bool ShouldSwapProcessesForRedirect(
103 content::ResourceContext* resource_context,
104 const GURL& current_url,
105 const GURL& new_url) OVERRIDE;
106 virtual bool ShouldAssignSiteForURL(const GURL& url) OVERRIDE;
107 virtual std::string GetCanonicalEncodingNameByAliasName(
108 const std::string& alias_name) OVERRIDE;
109 virtual void AppendExtraCommandLineSwitches(CommandLine* command_line,
110 int child_process_id) OVERRIDE;
111 virtual std::string GetApplicationLocale() OVERRIDE;
112 virtual std::string GetAcceptLangs(
113 content::BrowserContext* context) OVERRIDE;
114 virtual gfx::ImageSkia* GetDefaultFavicon() OVERRIDE;
115 virtual bool AllowAppCache(const GURL& manifest_url,
116 const GURL& first_party,
117 content::ResourceContext* context) OVERRIDE;
118 virtual bool AllowGetCookie(const GURL& url,
119 const GURL& first_party,
120 const net::CookieList& cookie_list,
121 content::ResourceContext* context,
122 int render_process_id,
123 int render_view_id) OVERRIDE;
124 virtual bool AllowSetCookie(const GURL& url,
125 const GURL& first_party,
126 const std::string& cookie_line,
127 content::ResourceContext* context,
128 int render_process_id,
129 int render_view_id,
130 net::CookieOptions* options) OVERRIDE;
131 virtual bool AllowSaveLocalState(content::ResourceContext* context) OVERRIDE;
132 virtual bool AllowWorkerDatabase(
133 const GURL& url,
134 const string16& name,
135 const string16& display_name,
136 unsigned long estimated_size,
137 content::ResourceContext* context,
138 const std::vector<std::pair<int, int> >& render_views) OVERRIDE;
139 virtual bool AllowWorkerFileSystem(
140 const GURL& url,
141 content::ResourceContext* context,
142 const std::vector<std::pair<int, int> >& render_views) OVERRIDE;
143 virtual bool AllowWorkerIndexedDB(
144 const GURL& url,
145 const string16& name,
146 content::ResourceContext* context,
147 const std::vector<std::pair<int, int> >& render_views) OVERRIDE;
148 virtual net::URLRequestContext* OverrideRequestContextForURL(
149 const GURL& url, content::ResourceContext* context) OVERRIDE;
150 virtual content::QuotaPermissionContext*
151 CreateQuotaPermissionContext() OVERRIDE;
152 virtual void AllowCertificateError(
153 int render_process_id,
154 int render_view_id,
155 int cert_error,
156 const net::SSLInfo& ssl_info,
157 const GURL& request_url,
158 ResourceType::Type resource_type,
159 bool overridable,
160 bool strict_enforcement,
161 const base::Callback<void(bool)>& callback,
162 content::CertificateRequestResultType* request) OVERRIDE;
163 virtual void SelectClientCertificate(
164 int render_process_id,
165 int render_view_id,
166 const net::HttpNetworkSession* network_session,
167 net::SSLCertRequestInfo* cert_request_info,
168 const base::Callback<void(net::X509Certificate*)>& callback) OVERRIDE;
169 virtual void AddCertificate(
170 net::URLRequest* request,
171 net::CertificateMimeType cert_type,
172 const void* cert_data,
173 size_t cert_size,
174 int render_process_id,
175 int render_view_id) OVERRIDE;
176 virtual content::MediaObserver* GetMediaObserver() OVERRIDE;
177 virtual void RequestDesktopNotificationPermission(
178 const GURL& source_origin,
179 int callback_context,
180 int render_process_id,
181 int render_view_id) OVERRIDE;
182 virtual WebKit::WebNotificationPresenter::Permission
183 CheckDesktopNotificationPermission(
184 const GURL& source_origin,
185 content::ResourceContext* context,
186 int render_process_id) OVERRIDE;
187 virtual void ShowDesktopNotification(
188 const content::ShowDesktopNotificationHostMsgParams& params,
189 int render_process_id,
190 int render_view_id,
191 bool worker) OVERRIDE;
192 virtual void CancelDesktopNotification(
193 int render_process_id,
194 int render_view_id,
195 int notification_id) OVERRIDE;
196 virtual bool CanCreateWindow(const GURL& opener_url,
197 const GURL& source_origin,
198 WindowContainerType container_type,
199 const GURL& target_url,
200 const content::Referrer& referrer,
201 WindowOpenDisposition disposition,
202 const WebKit::WebWindowFeatures& features,
203 bool user_gesture,
204 bool opener_suppressed,
205 content::ResourceContext* context,
206 int render_process_id,
207 bool is_guest,
208 int opener_id,
209 bool* no_javascript_access) OVERRIDE;
210 virtual std::string GetWorkerProcessTitle(
211 const GURL& url, content::ResourceContext* context) OVERRIDE;
212 virtual void ResourceDispatcherHostCreated() OVERRIDE;
213 virtual content::SpeechRecognitionManagerDelegate*
214 GetSpeechRecognitionManagerDelegate() OVERRIDE;
215 virtual net::NetLog* GetNetLog() OVERRIDE;
216 virtual content::AccessTokenStore* CreateAccessTokenStore() OVERRIDE;
217 virtual bool IsFastShutdownPossible() OVERRIDE;
218 virtual void OverrideWebkitPrefs(content::RenderViewHost* rvh,
219 const GURL& url,
220 WebPreferences* prefs) OVERRIDE;
221 virtual void UpdateInspectorSetting(content::RenderViewHost* rvh,
222 const std::string& key,
223 const std::string& value) OVERRIDE;
224 virtual void BrowserURLHandlerCreated(
225 content::BrowserURLHandler* handler) OVERRIDE;
226 virtual void ClearCache(content::RenderViewHost* rvh) OVERRIDE;
227 virtual void ClearCookies(content::RenderViewHost* rvh) OVERRIDE;
228 virtual base::FilePath GetDefaultDownloadDirectory() OVERRIDE;
229 virtual std::string GetDefaultDownloadName() OVERRIDE;
230 virtual void DidCreatePpapiPlugin(
231 content::BrowserPpapiHost* browser_host) OVERRIDE;
232 virtual content::BrowserPpapiHost* GetExternalBrowserPpapiHost(
233 int plugin_process_id) OVERRIDE;
234 virtual bool SupportsBrowserPlugin(content::BrowserContext* browser_context,
235 const GURL& site_url) OVERRIDE;
236 virtual bool AllowPepperSocketAPI(
237 content::BrowserContext* browser_context,
238 const GURL& url,
239 bool private_api,
240 const content::SocketPermissionRequest& params) OVERRIDE;
241 virtual ui::SelectFilePolicy* CreateSelectFilePolicy(
242 content::WebContents* web_contents) OVERRIDE;
243 virtual void GetAdditionalAllowedSchemesForFileSystem(
244 std::vector<std::string>* additional_schemes) OVERRIDE;
245 virtual void GetAdditionalFileSystemBackends(
246 content::BrowserContext* browser_context,
247 const base::FilePath& storage_partition_path,
248 ScopedVector<fileapi::FileSystemBackend>* additional_backends) OVERRIDE;
250 #if defined(OS_POSIX) && !defined(OS_MACOSX)
251 virtual void GetAdditionalMappedFilesForChildProcess(
252 const CommandLine& command_line,
253 int child_process_id,
254 std::vector<content::FileDescriptorInfo>* mappings) OVERRIDE;
255 #endif
256 #if defined(OS_WIN)
257 virtual const wchar_t* GetResourceDllName() OVERRIDE;
258 virtual void PreSpawnRenderer(sandbox::TargetPolicy* policy,
259 bool* success) OVERRIDE;
260 #endif
261 #if defined(USE_NSS)
262 virtual
263 crypto::CryptoModuleBlockingPasswordDelegate* GetCryptoPasswordDelegate(
264 const GURL& url) OVERRIDE;
265 #endif
267 private:
268 #if defined(ENABLE_PLUGINS)
269 // Set of origins that can use TCP/UDP private APIs from NaCl.
270 std::set<std::string> allowed_socket_origins_;
271 #endif
272 scoped_ptr<extensions::BrowserPermissionsPolicyDelegate>
273 permissions_policy_delegate_;
275 DISALLOW_COPY_AND_ASSIGN(ChromeContentBrowserClient);
278 } // namespace chrome
280 #endif // CHROME_BROWSER_CHROME_CONTENT_BROWSER_CLIENT_H_