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.
4
5 #include "content/public/browser/content_browser_client.h"
6
7 #include "base/files/file_path.h"
8 #include "ui/gfx/image/image_skia.h"
9 #include "url/gurl.h"
10
11 namespace content {
12
CreateBrowserMainParts(const MainFunctionParams & parameters)13 BrowserMainParts* ContentBrowserClient::CreateBrowserMainParts(
14 const MainFunctionParams& parameters) {
15 return NULL;
16 }
17
GetWebContentsViewDelegate(WebContents * web_contents)18 WebContentsViewDelegate* ContentBrowserClient::GetWebContentsViewDelegate(
19 WebContents* web_contents) {
20 return NULL;
21 }
22
GetEffectiveURL(BrowserContext * browser_context,const GURL & url)23 GURL ContentBrowserClient::GetEffectiveURL(BrowserContext* browser_context,
24 const GURL& url) {
25 return url;
26 }
27
ShouldUseProcessPerSite(BrowserContext * browser_context,const GURL & effective_url)28 bool ContentBrowserClient::ShouldUseProcessPerSite(
29 BrowserContext* browser_context, const GURL& effective_url) {
30 return false;
31 }
32
CreateRequestContext(BrowserContext * browser_context,ProtocolHandlerMap * protocol_handlers,URLRequestInterceptorScopedVector request_interceptors)33 net::URLRequestContextGetter* ContentBrowserClient::CreateRequestContext(
34 BrowserContext* browser_context,
35 ProtocolHandlerMap* protocol_handlers,
36 URLRequestInterceptorScopedVector request_interceptors) {
37 return NULL;
38 }
39
40 net::URLRequestContextGetter*
CreateRequestContextForStoragePartition(BrowserContext * browser_context,const base::FilePath & partition_path,bool in_memory,ProtocolHandlerMap * protocol_handlers,URLRequestInterceptorScopedVector request_interceptors)41 ContentBrowserClient::CreateRequestContextForStoragePartition(
42 BrowserContext* browser_context,
43 const base::FilePath& partition_path,
44 bool in_memory,
45 ProtocolHandlerMap* protocol_handlers,
46 URLRequestInterceptorScopedVector request_interceptors) {
47 return NULL;
48 }
49
IsHandledURL(const GURL & url)50 bool ContentBrowserClient::IsHandledURL(const GURL& url) {
51 return false;
52 }
53
CanCommitURL(RenderProcessHost * process_host,const GURL & site_url)54 bool ContentBrowserClient::CanCommitURL(RenderProcessHost* process_host,
55 const GURL& site_url) {
56 return true;
57 }
58
ShouldAllowOpenURL(SiteInstance * site_instance,const GURL & url)59 bool ContentBrowserClient::ShouldAllowOpenURL(SiteInstance* site_instance,
60 const GURL& url) {
61 return true;
62 }
63
IsSuitableHost(RenderProcessHost * process_host,const GURL & site_url)64 bool ContentBrowserClient::IsSuitableHost(RenderProcessHost* process_host,
65 const GURL& site_url) {
66 return true;
67 }
68
MayReuseHost(RenderProcessHost * process_host)69 bool ContentBrowserClient::MayReuseHost(RenderProcessHost* process_host) {
70 return true;
71 }
72
ShouldTryToUseExistingProcessHost(BrowserContext * browser_context,const GURL & url)73 bool ContentBrowserClient::ShouldTryToUseExistingProcessHost(
74 BrowserContext* browser_context, const GURL& url) {
75 return false;
76 }
77
ShouldSwapBrowsingInstancesForNavigation(SiteInstance * site_instance,const GURL & current_url,const GURL & new_url)78 bool ContentBrowserClient::ShouldSwapBrowsingInstancesForNavigation(
79 SiteInstance* site_instance,
80 const GURL& current_url,
81 const GURL& new_url) {
82 return false;
83 }
84
ShouldSwapProcessesForRedirect(ResourceContext * resource_context,const GURL & current_url,const GURL & new_url)85 bool ContentBrowserClient::ShouldSwapProcessesForRedirect(
86 ResourceContext* resource_context, const GURL& current_url,
87 const GURL& new_url) {
88 return false;
89 }
90
ShouldAssignSiteForURL(const GURL & url)91 bool ContentBrowserClient::ShouldAssignSiteForURL(const GURL& url) {
92 return true;
93 }
94
GetCanonicalEncodingNameByAliasName(const std::string & alias_name)95 std::string ContentBrowserClient::GetCanonicalEncodingNameByAliasName(
96 const std::string& alias_name) {
97 return std::string();
98 }
99
GetApplicationLocale()100 std::string ContentBrowserClient::GetApplicationLocale() {
101 return "en-US";
102 }
103
GetAcceptLangs(BrowserContext * context)104 std::string ContentBrowserClient::GetAcceptLangs(BrowserContext* context) {
105 return std::string();
106 }
107
GetDefaultFavicon()108 const gfx::ImageSkia* ContentBrowserClient::GetDefaultFavicon() {
109 static gfx::ImageSkia* empty = new gfx::ImageSkia();
110 return empty;
111 }
112
AllowAppCache(const GURL & manifest_url,const GURL & first_party,ResourceContext * context)113 bool ContentBrowserClient::AllowAppCache(const GURL& manifest_url,
114 const GURL& first_party,
115 ResourceContext* context) {
116 return true;
117 }
118
AllowGetCookie(const GURL & url,const GURL & first_party,const net::CookieList & cookie_list,ResourceContext * context,int render_process_id,int render_frame_id)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_frame_id) {
125 return true;
126 }
127
AllowSetCookie(const GURL & url,const GURL & first_party,const std::string & cookie_line,ResourceContext * context,int render_process_id,int render_frame_id,net::CookieOptions * options)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,
133 int render_frame_id,
134 net::CookieOptions* options) {
135 return true;
136 }
137
AllowSaveLocalState(ResourceContext * context)138 bool ContentBrowserClient::AllowSaveLocalState(ResourceContext* context) {
139 return true;
140 }
141
AllowWorkerDatabase(const GURL & url,const base::string16 & name,const base::string16 & display_name,unsigned long estimated_size,ResourceContext * context,const std::vector<std::pair<int,int>> & render_frames)142 bool ContentBrowserClient::AllowWorkerDatabase(
143 const GURL& url,
144 const base::string16& name,
145 const base::string16& display_name,
146 unsigned long estimated_size,
147 ResourceContext* context,
148 const std::vector<std::pair<int, int> >& render_frames) {
149 return true;
150 }
151
AllowWorkerFileSystem(const GURL & url,ResourceContext * context,const std::vector<std::pair<int,int>> & render_frames,base::Callback<void (bool)> callback)152 void ContentBrowserClient::AllowWorkerFileSystem(
153 const GURL& url,
154 ResourceContext* context,
155 const std::vector<std::pair<int, int> >& render_frames,
156 base::Callback<void(bool)> callback) {
157 callback.Run(true);
158 }
159
AllowWorkerIndexedDB(const GURL & url,const base::string16 & name,ResourceContext * context,const std::vector<std::pair<int,int>> & render_frames)160 bool ContentBrowserClient::AllowWorkerIndexedDB(
161 const GURL& url,
162 const base::string16& name,
163 ResourceContext* context,
164 const std::vector<std::pair<int, int> >& render_frames) {
165 return true;
166 }
167
CreateQuotaPermissionContext()168 QuotaPermissionContext* ContentBrowserClient::CreateQuotaPermissionContext() {
169 return NULL;
170 }
171
OverrideRequestContextForURL(const GURL & url,ResourceContext * context)172 net::URLRequestContext* ContentBrowserClient::OverrideRequestContextForURL(
173 const GURL& url, ResourceContext* context) {
174 return NULL;
175 }
176
GetStoragePartitionIdForSite(BrowserContext * browser_context,const GURL & site)177 std::string ContentBrowserClient::GetStoragePartitionIdForSite(
178 BrowserContext* browser_context,
179 const GURL& site) {
180 return std::string();
181 }
182
IsValidStoragePartitionId(BrowserContext * browser_context,const std::string & partition_id)183 bool ContentBrowserClient::IsValidStoragePartitionId(
184 BrowserContext* browser_context,
185 const std::string& partition_id) {
186 // Since the GetStoragePartitionIdForChildProcess() only generates empty
187 // strings, we should only ever see empty strings coming back.
188 return partition_id.empty();
189 }
190
GetStoragePartitionConfigForSite(BrowserContext * browser_context,const GURL & site,bool can_be_default,std::string * partition_domain,std::string * partition_name,bool * in_memory)191 void ContentBrowserClient::GetStoragePartitionConfigForSite(
192 BrowserContext* browser_context,
193 const GURL& site,
194 bool can_be_default,
195 std::string* partition_domain,
196 std::string* partition_name,
197 bool* in_memory) {
198 partition_domain->clear();
199 partition_name->clear();
200 *in_memory = false;
201 }
202
GetMediaObserver()203 MediaObserver* ContentBrowserClient::GetMediaObserver() {
204 return NULL;
205 }
206
207 blink::WebNotificationPermission
CheckDesktopNotificationPermission(const GURL & source_origin,ResourceContext * context,int render_process_id)208 ContentBrowserClient::CheckDesktopNotificationPermission(
209 const GURL& source_origin,
210 ResourceContext* context,
211 int render_process_id) {
212 return blink::WebNotificationPermissionAllowed;
213 }
214
RequestGeolocationPermission(WebContents * web_contents,int bridge_id,const GURL & requesting_frame,bool user_gesture,base::Callback<void (bool)> result_callback,base::Closure * cancel_callback)215 void ContentBrowserClient::RequestGeolocationPermission(
216 WebContents* web_contents,
217 int bridge_id,
218 const GURL& requesting_frame,
219 bool user_gesture,
220 base::Callback<void(bool)> result_callback,
221 base::Closure* cancel_callback) {
222 result_callback.Run(true);
223 }
224
RequestMidiSysExPermission(WebContents * web_contents,int bridge_id,const GURL & requesting_frame,bool user_gesture,base::Callback<void (bool)> result_callback,base::Closure * cancel_callback)225 void ContentBrowserClient::RequestMidiSysExPermission(
226 WebContents* web_contents,
227 int bridge_id,
228 const GURL& requesting_frame,
229 bool user_gesture,
230 base::Callback<void(bool)> result_callback,
231 base::Closure* cancel_callback) {
232 result_callback.Run(true);
233 }
234
RequestProtectedMediaIdentifierPermission(WebContents * web_contents,const GURL & origin,base::Callback<void (bool)> result_callback,base::Closure * cancel_callback)235 void ContentBrowserClient::RequestProtectedMediaIdentifierPermission(
236 WebContents* web_contents,
237 const GURL& origin,
238 base::Callback<void(bool)> result_callback,
239 base::Closure* cancel_callback) {
240 result_callback.Run(true);
241 }
242
CanCreateWindow(const GURL & opener_url,const GURL & opener_top_level_frame_url,const GURL & source_origin,WindowContainerType container_type,const GURL & target_url,const Referrer & referrer,WindowOpenDisposition disposition,const blink::WebWindowFeatures & features,bool user_gesture,bool opener_suppressed,ResourceContext * context,int render_process_id,int opener_id,bool * no_javascript_access)243 bool ContentBrowserClient::CanCreateWindow(
244 const GURL& opener_url,
245 const GURL& opener_top_level_frame_url,
246 const GURL& source_origin,
247 WindowContainerType container_type,
248 const GURL& target_url,
249 const Referrer& referrer,
250 WindowOpenDisposition disposition,
251 const blink::WebWindowFeatures& features,
252 bool user_gesture,
253 bool opener_suppressed,
254 ResourceContext* context,
255 int render_process_id,
256 int opener_id,
257 bool* no_javascript_access) {
258 *no_javascript_access = false;
259 return true;
260 }
261
262 SpeechRecognitionManagerDelegate*
GetSpeechRecognitionManagerDelegate()263 ContentBrowserClient::GetSpeechRecognitionManagerDelegate() {
264 return NULL;
265 }
266
GetNetLog()267 net::NetLog* ContentBrowserClient::GetNetLog() {
268 return NULL;
269 }
270
CreateAccessTokenStore()271 AccessTokenStore* ContentBrowserClient::CreateAccessTokenStore() {
272 return NULL;
273 }
274
IsFastShutdownPossible()275 bool ContentBrowserClient::IsFastShutdownPossible() {
276 return true;
277 }
278
GetDefaultDownloadDirectory()279 base::FilePath ContentBrowserClient::GetDefaultDownloadDirectory() {
280 return base::FilePath();
281 }
282
GetDefaultDownloadName()283 std::string ContentBrowserClient::GetDefaultDownloadName() {
284 return std::string();
285 }
286
287 BrowserPpapiHost*
GetExternalBrowserPpapiHost(int plugin_process_id)288 ContentBrowserClient::GetExternalBrowserPpapiHost(int plugin_process_id) {
289 return NULL;
290 }
291
AllowPepperSocketAPI(BrowserContext * browser_context,const GURL & url,bool private_api,const SocketPermissionRequest * params)292 bool ContentBrowserClient::AllowPepperSocketAPI(
293 BrowserContext* browser_context,
294 const GURL& url,
295 bool private_api,
296 const SocketPermissionRequest* params) {
297 return false;
298 }
299
CreateSelectFilePolicy(WebContents * web_contents)300 ui::SelectFilePolicy* ContentBrowserClient::CreateSelectFilePolicy(
301 WebContents* web_contents) {
302 return NULL;
303 }
304
OverrideSystemLocationProvider()305 LocationProvider* ContentBrowserClient::OverrideSystemLocationProvider() {
306 return NULL;
307 }
308
OverrideVibrationProvider()309 VibrationProvider* ContentBrowserClient::OverrideVibrationProvider() {
310 return NULL;
311 }
312
GetDevToolsManagerDelegate()313 DevToolsManagerDelegate* ContentBrowserClient::GetDevToolsManagerDelegate() {
314 return NULL;
315 }
316
IsPluginAllowedToCallRequestOSFileHandle(BrowserContext * browser_context,const GURL & url)317 bool ContentBrowserClient::IsPluginAllowedToCallRequestOSFileHandle(
318 BrowserContext* browser_context,
319 const GURL& url) {
320 return false;
321 }
322
IsPluginAllowedToUseDevChannelAPIs(BrowserContext * browser_context,const GURL & url)323 bool ContentBrowserClient::IsPluginAllowedToUseDevChannelAPIs(
324 BrowserContext* browser_context,
325 const GURL& url) {
326 return false;
327 }
328
OverrideCookieStoreForRenderProcess(int render_process_id)329 net::CookieStore* ContentBrowserClient::OverrideCookieStoreForRenderProcess(
330 int render_process_id) {
331 return NULL;
332 }
333
334 #if defined(OS_WIN)
GetResourceDllName()335 const wchar_t* ContentBrowserClient::GetResourceDllName() {
336 return NULL;
337 }
338 #endif
339
340 #if defined(VIDEO_HOLE)
341 ExternalVideoSurfaceContainer*
OverrideCreateExternalVideoSurfaceContainer(WebContents * web_contents)342 ContentBrowserClient::OverrideCreateExternalVideoSurfaceContainer(
343 WebContents* web_contents) {
344 return NULL;
345 }
346 #endif
347
CheckMediaAccessPermission(BrowserContext * browser_context,const GURL & security_origin,MediaStreamType type)348 bool ContentBrowserClient::CheckMediaAccessPermission(
349 BrowserContext* browser_context,
350 const GURL& security_origin,
351 MediaStreamType type) {
352 return false;
353 }
354
355 } // namespace content
356