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 WebContentsViewDelegate* ContentBrowserClient::GetWebContentsViewDelegate(
19 WebContents* web_contents) {
23 GURL ContentBrowserClient::GetEffectiveURL(BrowserContext* browser_context,
28 bool ContentBrowserClient::ShouldUseProcessPerSite(
29 BrowserContext* browser_context, const GURL& effective_url) {
33 net::URLRequestContextGetter* ContentBrowserClient::CreateRequestContext(
34 BrowserContext* browser_context,
35 ProtocolHandlerMap* protocol_handlers,
36 ProtocolHandlerScopedVector protocol_interceptors) {
40 net::URLRequestContextGetter*
41 ContentBrowserClient::CreateRequestContextForStoragePartition(
42 BrowserContext* browser_context,
43 const base::FilePath& partition_path,
45 ProtocolHandlerMap* protocol_handlers,
46 ProtocolHandlerScopedVector protocol_interceptors) {
50 bool ContentBrowserClient::IsHandledURL(const GURL& url) {
54 bool ContentBrowserClient::CanCommitURL(RenderProcessHost* process_host,
55 const GURL& site_url) {
59 bool ContentBrowserClient::ShouldAllowOpenURL(SiteInstance* site_instance,
64 bool ContentBrowserClient::IsSuitableHost(RenderProcessHost* process_host,
65 const GURL& site_url) {
69 bool ContentBrowserClient::ShouldTryToUseExistingProcessHost(
70 BrowserContext* browser_context, const GURL& url) {
74 bool ContentBrowserClient::ShouldSwapBrowsingInstancesForNavigation(
75 SiteInstance* site_instance,
76 const GURL& current_url,
77 const GURL& new_url) {
81 bool ContentBrowserClient::ShouldSwapProcessesForRedirect(
82 ResourceContext* resource_context, const GURL& current_url,
83 const GURL& new_url) {
87 bool ContentBrowserClient::ShouldAssignSiteForURL(const GURL& url) {
91 std::string ContentBrowserClient::GetCanonicalEncodingNameByAliasName(
92 const std::string& alias_name) {
96 std::string ContentBrowserClient::GetApplicationLocale() {
100 std::string ContentBrowserClient::GetAcceptLangs(BrowserContext* context) {
101 return std::string();
104 gfx::ImageSkia* ContentBrowserClient::GetDefaultFavicon() {
105 static gfx::ImageSkia* empty = new gfx::ImageSkia();
109 bool ContentBrowserClient::AllowAppCache(const GURL& manifest_url,
110 const GURL& first_party,
111 ResourceContext* context) {
115 bool ContentBrowserClient::AllowGetCookie(const GURL& url,
116 const GURL& first_party,
117 const net::CookieList& cookie_list,
118 ResourceContext* context,
119 int render_process_id,
120 int render_frame_id) {
124 bool ContentBrowserClient::AllowSetCookie(const GURL& url,
125 const GURL& first_party,
126 const std::string& cookie_line,
127 ResourceContext* context,
128 int render_process_id,
130 net::CookieOptions* options) {
134 bool ContentBrowserClient::AllowSaveLocalState(ResourceContext* context) {
138 bool ContentBrowserClient::AllowWorkerDatabase(
140 const base::string16& name,
141 const base::string16& display_name,
142 unsigned long estimated_size,
143 ResourceContext* context,
144 const std::vector<std::pair<int, int> >& render_frames) {
148 bool ContentBrowserClient::AllowWorkerFileSystem(
150 ResourceContext* context,
151 const std::vector<std::pair<int, int> >& render_frames) {
155 bool ContentBrowserClient::AllowWorkerIndexedDB(
157 const base::string16& name,
158 ResourceContext* context,
159 const std::vector<std::pair<int, int> >& render_frames) {
163 QuotaPermissionContext* ContentBrowserClient::CreateQuotaPermissionContext() {
167 net::URLRequestContext* ContentBrowserClient::OverrideRequestContextForURL(
168 const GURL& url, ResourceContext* context) {
172 std::string ContentBrowserClient::GetStoragePartitionIdForSite(
173 BrowserContext* browser_context,
175 return std::string();
178 bool ContentBrowserClient::IsValidStoragePartitionId(
179 BrowserContext* browser_context,
180 const std::string& partition_id) {
181 // Since the GetStoragePartitionIdForChildProcess() only generates empty
182 // strings, we should only ever see empty strings coming back.
183 return partition_id.empty();
186 void ContentBrowserClient::GetStoragePartitionConfigForSite(
187 BrowserContext* browser_context,
190 std::string* partition_domain,
191 std::string* partition_name,
193 partition_domain->clear();
194 partition_name->clear();
198 MediaObserver* ContentBrowserClient::GetMediaObserver() {
202 blink::WebNotificationPresenter::Permission
203 ContentBrowserClient::CheckDesktopNotificationPermission(
204 const GURL& source_origin,
205 ResourceContext* context,
206 int render_process_id) {
207 return blink::WebNotificationPresenter::PermissionAllowed;
210 bool ContentBrowserClient::CanCreateWindow(
211 const GURL& opener_url,
212 const GURL& opener_top_level_frame_url,
213 const GURL& source_origin,
214 WindowContainerType container_type,
215 const GURL& target_url,
216 const content::Referrer& referrer,
217 WindowOpenDisposition disposition,
218 const blink::WebWindowFeatures& features,
220 bool opener_suppressed,
221 content::ResourceContext* context,
222 int render_process_id,
225 bool* no_javascript_access) {
226 *no_javascript_access = false;
230 std::string ContentBrowserClient::GetWorkerProcessTitle(
231 const GURL& url, ResourceContext* context) {
232 return std::string();
235 SpeechRecognitionManagerDelegate*
236 ContentBrowserClient::GetSpeechRecognitionManagerDelegate() {
240 net::NetLog* ContentBrowserClient::GetNetLog() {
244 AccessTokenStore* ContentBrowserClient::CreateAccessTokenStore() {
248 bool ContentBrowserClient::IsFastShutdownPossible() {
252 base::FilePath ContentBrowserClient::GetDefaultDownloadDirectory() {
253 return base::FilePath();
256 std::string ContentBrowserClient::GetDefaultDownloadName() {
257 return std::string();
261 ContentBrowserClient::GetExternalBrowserPpapiHost(int plugin_process_id) {
265 bool ContentBrowserClient::AllowPepperSocketAPI(
266 BrowserContext* browser_context,
269 const SocketPermissionRequest* params) {
273 ui::SelectFilePolicy* ContentBrowserClient::CreateSelectFilePolicy(
274 WebContents* web_contents) {
278 LocationProvider* ContentBrowserClient::OverrideSystemLocationProvider() {
282 VibrationProvider* ContentBrowserClient::OverrideVibrationProvider() {
287 const wchar_t* ContentBrowserClient::GetResourceDllName() {
292 bool ContentBrowserClient::IsPluginAllowedToCallRequestOSFileHandle(
293 content::BrowserContext* browser_context,
298 bool ContentBrowserClient::IsPluginAllowedToUseDevChannelAPIs() {
302 net::CookieStore* ContentBrowserClient::OverrideCookieStoreForRenderProcess(
303 int render_process_id) {
307 #if defined(VIDEO_HOLE)
308 ExternalVideoSurfaceContainer*
309 ContentBrowserClient::OverrideCreateExternalVideoSurfaceContainer(
310 WebContents* web_contents) {
315 } // namespace content