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 #include "content/public/browser/content_browser_client.h"
7 #include "base/files/file_path.h"
8 #include "ui/gfx/image/image_skia.h"
13 BrowserMainParts
* ContentBrowserClient::CreateBrowserMainParts(
14 const MainFunctionParams
& parameters
) {
18 WebContentsViewPort
* ContentBrowserClient::OverrideCreateWebContentsView(
19 WebContents
* web_contents
,
20 RenderViewHostDelegateView
** render_view_host_delegate_view
) {
24 WebContentsViewDelegate
* ContentBrowserClient::GetWebContentsViewDelegate(
25 WebContents
* web_contents
) {
29 GURL
ContentBrowserClient::GetEffectiveURL(BrowserContext
* browser_context
,
34 bool ContentBrowserClient::ShouldUseProcessPerSite(
35 BrowserContext
* browser_context
, const GURL
& effective_url
) {
39 net::URLRequestContextGetter
* ContentBrowserClient::CreateRequestContext(
40 BrowserContext
* browser_context
,
41 ProtocolHandlerMap
* protocol_handlers
) {
45 net::URLRequestContextGetter
*
46 ContentBrowserClient::CreateRequestContextForStoragePartition(
47 BrowserContext
* browser_context
,
48 const base::FilePath
& partition_path
,
50 ProtocolHandlerMap
* protocol_handlers
) {
54 bool ContentBrowserClient::IsHandledURL(const GURL
& url
) {
58 bool ContentBrowserClient::CanCommitURL(RenderProcessHost
* process_host
,
59 const GURL
& site_url
) {
63 bool ContentBrowserClient::ShouldAllowOpenURL(SiteInstance
* site_instance
,
68 bool ContentBrowserClient::IsSuitableHost(RenderProcessHost
* process_host
,
69 const GURL
& site_url
) {
73 bool ContentBrowserClient::ShouldTryToUseExistingProcessHost(
74 BrowserContext
* browser_context
, const GURL
& url
) {
78 bool ContentBrowserClient::ShouldSwapProcessesForNavigation(
79 SiteInstance
* site_instance
,
80 const GURL
& current_url
,
81 const GURL
& new_url
) {
85 bool ContentBrowserClient::ShouldSwapProcessesForRedirect(
86 ResourceContext
* resource_context
, const GURL
& current_url
,
87 const GURL
& new_url
) {
91 bool ContentBrowserClient::ShouldAssignSiteForURL(const GURL
& url
) {
95 std::string
ContentBrowserClient::GetCanonicalEncodingNameByAliasName(
96 const std::string
& alias_name
) {
100 std::string
ContentBrowserClient::GetApplicationLocale() {
104 std::string
ContentBrowserClient::GetAcceptLangs(BrowserContext
* context
) {
105 return std::string();
108 gfx::ImageSkia
* ContentBrowserClient::GetDefaultFavicon() {
109 static gfx::ImageSkia
* empty
= new gfx::ImageSkia();
113 bool ContentBrowserClient::AllowAppCache(const GURL
& manifest_url
,
114 const GURL
& first_party
,
115 ResourceContext
* context
) {
119 bool ContentBrowserClient::AllowGetCookie(const GURL
& url
,
120 const GURL
& first_party
,
121 const net::CookieList
& cookie_list
,
122 ResourceContext
* context
,
123 int render_process_id
,
124 int render_view_id
) {
128 bool ContentBrowserClient::AllowSetCookie(const GURL
& url
,
129 const GURL
& first_party
,
130 const std::string
& cookie_line
,
131 ResourceContext
* context
,
132 int render_process_id
,
134 net::CookieOptions
* options
) {
138 bool ContentBrowserClient::AllowSaveLocalState(ResourceContext
* context
) {
142 bool ContentBrowserClient::AllowWorkerDatabase(
144 const string16
& name
,
145 const string16
& display_name
,
146 unsigned long estimated_size
,
147 ResourceContext
* context
,
148 const std::vector
<std::pair
<int, int> >& render_views
) {
152 bool ContentBrowserClient::AllowWorkerFileSystem(
154 ResourceContext
* context
,
155 const std::vector
<std::pair
<int, int> >& render_views
) {
159 bool ContentBrowserClient::AllowWorkerIndexedDB(
161 const string16
& name
,
162 ResourceContext
* context
,
163 const std::vector
<std::pair
<int, int> >& render_views
) {
167 QuotaPermissionContext
* ContentBrowserClient::CreateQuotaPermissionContext() {
171 net::URLRequestContext
* ContentBrowserClient::OverrideRequestContextForURL(
172 const GURL
& url
, ResourceContext
* context
) {
176 std::string
ContentBrowserClient::GetStoragePartitionIdForSite(
177 BrowserContext
* browser_context
,
179 return std::string();
182 bool ContentBrowserClient::IsValidStoragePartitionId(
183 BrowserContext
* browser_context
,
184 const std::string
& partition_id
) {
185 // Since the GetStoragePartitionIdForChildProcess() only generates empty
186 // strings, we should only ever see empty strings coming back.
187 return partition_id
.empty();
190 void ContentBrowserClient::GetStoragePartitionConfigForSite(
191 BrowserContext
* browser_context
,
194 std::string
* partition_domain
,
195 std::string
* partition_name
,
197 partition_domain
->clear();
198 partition_name
->clear();
202 MediaObserver
* ContentBrowserClient::GetMediaObserver() {
206 WebKit::WebNotificationPresenter::Permission
207 ContentBrowserClient::CheckDesktopNotificationPermission(
208 const GURL
& source_origin
,
209 ResourceContext
* context
,
210 int render_process_id
) {
211 return WebKit::WebNotificationPresenter::PermissionAllowed
;
214 bool ContentBrowserClient::CanCreateWindow(
215 const GURL
& opener_url
,
216 const GURL
& opener_top_level_frame_url
,
217 const GURL
& source_origin
,
218 WindowContainerType container_type
,
219 const GURL
& target_url
,
220 const content::Referrer
& referrer
,
221 WindowOpenDisposition disposition
,
222 const WebKit::WebWindowFeatures
& features
,
224 bool opener_suppressed
,
225 content::ResourceContext
* context
,
226 int render_process_id
,
229 bool* no_javascript_access
) {
230 *no_javascript_access
= false;
234 std::string
ContentBrowserClient::GetWorkerProcessTitle(
235 const GURL
& url
, ResourceContext
* context
) {
236 return std::string();
239 SpeechRecognitionManagerDelegate
*
240 ContentBrowserClient::GetSpeechRecognitionManagerDelegate() {
244 net::NetLog
* ContentBrowserClient::GetNetLog() {
248 AccessTokenStore
* ContentBrowserClient::CreateAccessTokenStore() {
252 bool ContentBrowserClient::IsFastShutdownPossible() {
256 base::FilePath
ContentBrowserClient::GetDefaultDownloadDirectory() {
257 return base::FilePath();
260 std::string
ContentBrowserClient::GetDefaultDownloadName() {
261 return std::string();
265 ContentBrowserClient::GetExternalBrowserPpapiHost(int plugin_process_id
) {
269 bool ContentBrowserClient::SupportsBrowserPlugin(
270 BrowserContext
* browser_context
, const GURL
& site_url
) {
274 bool ContentBrowserClient::AllowPepperSocketAPI(
275 BrowserContext
* browser_context
,
278 const SocketPermissionRequest
* params
) {
282 ui::SelectFilePolicy
* ContentBrowserClient::CreateSelectFilePolicy(
283 WebContents
* web_contents
) {
287 LocationProvider
* ContentBrowserClient::OverrideSystemLocationProvider() {
292 const wchar_t* ContentBrowserClient::GetResourceDllName() {
298 crypto::CryptoModuleBlockingPasswordDelegate
*
299 ContentBrowserClient::GetCryptoPasswordDelegate(const GURL
& url
) {
304 bool ContentBrowserClient::IsPluginAllowedToCallRequestOSFileHandle(
305 content::BrowserContext
* browser_context
,
310 } // namespace content