Content settings: remove some plugin-related code/resources when... there are no...
[chromium-blink-merge.git] / content / public / browser / content_browser_client.cc
blob01b58bd9d148828546b7e7c2fe3d810fa847e548
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 "content/public/browser/client_certificate_delegate.h"
9 #include "content/public/common/sandbox_type.h"
10 #include "ui/gfx/image/image_skia.h"
11 #include "url/gurl.h"
13 namespace content {
15 BrowserMainParts* ContentBrowserClient::CreateBrowserMainParts(
16 const MainFunctionParams& parameters) {
17 return nullptr;
20 void ContentBrowserClient::PostAfterStartupTask(
21 const tracked_objects::Location& from_here,
22 const scoped_refptr<base::TaskRunner>& task_runner,
23 const base::Closure& task) {
24 task_runner->PostTask(from_here, task);
27 WebContentsViewDelegate* ContentBrowserClient::GetWebContentsViewDelegate(
28 WebContents* web_contents) {
29 return nullptr;
32 GURL ContentBrowserClient::GetEffectiveURL(BrowserContext* browser_context,
33 const GURL& url) {
34 return url;
37 bool ContentBrowserClient::ShouldUseProcessPerSite(
38 BrowserContext* browser_context, const GURL& effective_url) {
39 return false;
42 bool ContentBrowserClient::ShouldLockToOrigin(BrowserContext* browser_context,
43 const GURL& effective_url) {
44 return true;
47 net::URLRequestContextGetter* ContentBrowserClient::CreateRequestContext(
48 BrowserContext* browser_context,
49 ProtocolHandlerMap* protocol_handlers,
50 URLRequestInterceptorScopedVector request_interceptors) {
51 return nullptr;
54 net::URLRequestContextGetter*
55 ContentBrowserClient::CreateRequestContextForStoragePartition(
56 BrowserContext* browser_context,
57 const base::FilePath& partition_path,
58 bool in_memory,
59 ProtocolHandlerMap* protocol_handlers,
60 URLRequestInterceptorScopedVector request_interceptors) {
61 return nullptr;
64 bool ContentBrowserClient::IsHandledURL(const GURL& url) {
65 return false;
68 bool ContentBrowserClient::CanCommitURL(RenderProcessHost* process_host,
69 const GURL& site_url) {
70 return true;
73 bool ContentBrowserClient::IsIllegalOrigin(ResourceContext* resource_context,
74 int child_process_id,
75 const GURL& origin) {
76 return false;
79 bool ContentBrowserClient::ShouldAllowOpenURL(SiteInstance* site_instance,
80 const GURL& url) {
81 return true;
84 bool ContentBrowserClient::IsSuitableHost(RenderProcessHost* process_host,
85 const GURL& site_url) {
86 return true;
89 bool ContentBrowserClient::MayReuseHost(RenderProcessHost* process_host) {
90 return true;
93 bool ContentBrowserClient::ShouldTryToUseExistingProcessHost(
94 BrowserContext* browser_context, const GURL& url) {
95 return false;
98 bool ContentBrowserClient::ShouldSwapBrowsingInstancesForNavigation(
99 SiteInstance* site_instance,
100 const GURL& current_url,
101 const GURL& new_url) {
102 return false;
105 bool ContentBrowserClient::ShouldSwapProcessesForRedirect(
106 ResourceContext* resource_context, const GURL& current_url,
107 const GURL& new_url) {
108 return false;
111 bool ContentBrowserClient::ShouldAssignSiteForURL(const GURL& url) {
112 return true;
115 std::string ContentBrowserClient::GetCanonicalEncodingNameByAliasName(
116 const std::string& alias_name) {
117 return std::string();
120 std::string ContentBrowserClient::GetApplicationLocale() {
121 return "en-US";
124 std::string ContentBrowserClient::GetAcceptLangs(BrowserContext* context) {
125 return std::string();
128 const gfx::ImageSkia* ContentBrowserClient::GetDefaultFavicon() {
129 static gfx::ImageSkia* empty = new gfx::ImageSkia();
130 return empty;
133 bool ContentBrowserClient::AllowAppCache(const GURL& manifest_url,
134 const GURL& first_party,
135 ResourceContext* context) {
136 return true;
139 bool ContentBrowserClient::AllowServiceWorker(const GURL& scope,
140 const GURL& document_url,
141 content::ResourceContext* context,
142 int render_process_id,
143 int render_frame_id) {
144 return true;
147 bool ContentBrowserClient::AllowGetCookie(const GURL& url,
148 const GURL& first_party,
149 const net::CookieList& cookie_list,
150 ResourceContext* context,
151 int render_process_id,
152 int render_frame_id) {
153 return true;
156 bool ContentBrowserClient::AllowSetCookie(const GURL& url,
157 const GURL& first_party,
158 const std::string& cookie_line,
159 ResourceContext* context,
160 int render_process_id,
161 int render_frame_id,
162 net::CookieOptions* options) {
163 return true;
166 bool ContentBrowserClient::AllowSaveLocalState(ResourceContext* context) {
167 return true;
170 bool ContentBrowserClient::AllowWorkerDatabase(
171 const GURL& url,
172 const base::string16& name,
173 const base::string16& display_name,
174 unsigned long estimated_size,
175 ResourceContext* context,
176 const std::vector<std::pair<int, int> >& render_frames) {
177 return true;
180 void ContentBrowserClient::AllowWorkerFileSystem(
181 const GURL& url,
182 ResourceContext* context,
183 const std::vector<std::pair<int, int> >& render_frames,
184 base::Callback<void(bool)> callback) {
185 callback.Run(true);
188 bool ContentBrowserClient::AllowWorkerIndexedDB(
189 const GURL& url,
190 const base::string16& name,
191 ResourceContext* context,
192 const std::vector<std::pair<int, int> >& render_frames) {
193 return true;
196 #if defined(ENABLE_WEBRTC)
197 bool ContentBrowserClient::AllowWebRTCIdentityCache(const GURL& url,
198 const GURL& first_party_url,
199 ResourceContext* context) {
200 return true;
202 #endif // defined(ENABLE_WEBRTC)
204 QuotaPermissionContext* ContentBrowserClient::CreateQuotaPermissionContext() {
205 return nullptr;
208 void ContentBrowserClient::SelectClientCertificate(
209 WebContents* web_contents,
210 net::SSLCertRequestInfo* cert_request_info,
211 scoped_ptr<ClientCertificateDelegate> delegate) {
214 net::URLRequestContext* ContentBrowserClient::OverrideRequestContextForURL(
215 const GURL& url, ResourceContext* context) {
216 return nullptr;
219 std::string ContentBrowserClient::GetStoragePartitionIdForSite(
220 BrowserContext* browser_context,
221 const GURL& site) {
222 return std::string();
225 bool ContentBrowserClient::IsValidStoragePartitionId(
226 BrowserContext* browser_context,
227 const std::string& partition_id) {
228 // Since the GetStoragePartitionIdForChildProcess() only generates empty
229 // strings, we should only ever see empty strings coming back.
230 return partition_id.empty();
233 void ContentBrowserClient::GetStoragePartitionConfigForSite(
234 BrowserContext* browser_context,
235 const GURL& site,
236 bool can_be_default,
237 std::string* partition_domain,
238 std::string* partition_name,
239 bool* in_memory) {
240 partition_domain->clear();
241 partition_name->clear();
242 *in_memory = false;
245 MediaObserver* ContentBrowserClient::GetMediaObserver() {
246 return nullptr;
249 PlatformNotificationService*
250 ContentBrowserClient::GetPlatformNotificationService() {
251 return nullptr;
254 bool ContentBrowserClient::CanCreateWindow(
255 const GURL& opener_url,
256 const GURL& opener_top_level_frame_url,
257 const GURL& source_origin,
258 WindowContainerType container_type,
259 const GURL& target_url,
260 const Referrer& referrer,
261 WindowOpenDisposition disposition,
262 const blink::WebWindowFeatures& features,
263 bool user_gesture,
264 bool opener_suppressed,
265 ResourceContext* context,
266 int render_process_id,
267 int opener_render_view_id,
268 int opener_render_frame_id,
269 bool* no_javascript_access) {
270 *no_javascript_access = false;
271 return true;
274 SpeechRecognitionManagerDelegate*
275 ContentBrowserClient::CreateSpeechRecognitionManagerDelegate() {
276 return nullptr;
279 net::NetLog* ContentBrowserClient::GetNetLog() {
280 return nullptr;
283 AccessTokenStore* ContentBrowserClient::CreateAccessTokenStore() {
284 return nullptr;
287 bool ContentBrowserClient::IsFastShutdownPossible() {
288 return true;
291 base::FilePath ContentBrowserClient::GetDefaultDownloadDirectory() {
292 return base::FilePath();
295 std::string ContentBrowserClient::GetDefaultDownloadName() {
296 return std::string();
299 base::FilePath ContentBrowserClient::GetShaderDiskCacheDirectory() {
300 return base::FilePath();
303 BrowserPpapiHost*
304 ContentBrowserClient::GetExternalBrowserPpapiHost(int plugin_process_id) {
305 return nullptr;
308 bool ContentBrowserClient::AllowPepperSocketAPI(
309 BrowserContext* browser_context,
310 const GURL& url,
311 bool private_api,
312 const SocketPermissionRequest* params) {
313 return false;
316 ui::SelectFilePolicy* ContentBrowserClient::CreateSelectFilePolicy(
317 WebContents* web_contents) {
318 return nullptr;
321 LocationProvider* ContentBrowserClient::OverrideSystemLocationProvider() {
322 return nullptr;
325 DevToolsManagerDelegate* ContentBrowserClient::GetDevToolsManagerDelegate() {
326 return nullptr;
329 TracingDelegate* ContentBrowserClient::GetTracingDelegate() {
330 return nullptr;
333 bool ContentBrowserClient::IsNPAPIEnabled() {
334 return false;
337 bool ContentBrowserClient::IsPluginAllowedToCallRequestOSFileHandle(
338 BrowserContext* browser_context,
339 const GURL& url) {
340 return false;
343 bool ContentBrowserClient::IsPluginAllowedToUseDevChannelAPIs(
344 BrowserContext* browser_context,
345 const GURL& url) {
346 return false;
349 PresentationServiceDelegate*
350 ContentBrowserClient::GetPresentationServiceDelegate(
351 WebContents* web_contents) {
352 return nullptr;
355 void ContentBrowserClient::OpenURL(
356 content::BrowserContext* browser_context,
357 const content::OpenURLParams& params,
358 const base::Callback<void(content::WebContents*)>& callback) {
359 callback.Run(nullptr);
362 #if defined(OS_WIN)
363 const wchar_t* ContentBrowserClient::GetResourceDllName() {
364 return nullptr;
367 base::string16 ContentBrowserClient::GetAppContainerSidForSandboxType(
368 int sandbox_type) const {
369 // Embedders should override this method and return different SIDs for each
370 // sandbox type. Note: All content level tests will run child processes in the
371 // same AppContainer.
372 return base::string16(
373 L"S-1-15-2-3251537155-1984446955-2931258699-841473695-1938553385-"
374 L"924012148-129201922");
376 #endif
378 #if defined(VIDEO_HOLE)
379 ExternalVideoSurfaceContainer*
380 ContentBrowserClient::OverrideCreateExternalVideoSurfaceContainer(
381 WebContents* web_contents) {
382 NOTREACHED() << "Hole-punching is not supported. See crbug.com/469348.";
383 return nullptr;
385 #endif
387 } // namespace content