Popular sites on the NTP: Try to keep the ordering constant
[chromium-blink-merge.git] / content / public / browser / content_browser_client.cc
blob59fe2663c12c8f7640b4d4a57b4f8e431fa9e678
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 net::URLRequestContextGetter* ContentBrowserClient::CreateRequestContext(
43 BrowserContext* browser_context,
44 ProtocolHandlerMap* protocol_handlers,
45 URLRequestInterceptorScopedVector request_interceptors) {
46 return nullptr;
49 net::URLRequestContextGetter*
50 ContentBrowserClient::CreateRequestContextForStoragePartition(
51 BrowserContext* browser_context,
52 const base::FilePath& partition_path,
53 bool in_memory,
54 ProtocolHandlerMap* protocol_handlers,
55 URLRequestInterceptorScopedVector request_interceptors) {
56 return nullptr;
59 bool ContentBrowserClient::IsHandledURL(const GURL& url) {
60 return false;
63 bool ContentBrowserClient::CanCommitURL(RenderProcessHost* process_host,
64 const GURL& site_url) {
65 return true;
68 bool ContentBrowserClient::ShouldAllowOpenURL(SiteInstance* site_instance,
69 const GURL& url) {
70 return true;
73 bool ContentBrowserClient::IsSuitableHost(RenderProcessHost* process_host,
74 const GURL& site_url) {
75 return true;
78 bool ContentBrowserClient::MayReuseHost(RenderProcessHost* process_host) {
79 return true;
82 bool ContentBrowserClient::ShouldTryToUseExistingProcessHost(
83 BrowserContext* browser_context, const GURL& url) {
84 return false;
87 bool ContentBrowserClient::ShouldSwapBrowsingInstancesForNavigation(
88 SiteInstance* site_instance,
89 const GURL& current_url,
90 const GURL& new_url) {
91 return false;
94 bool ContentBrowserClient::ShouldSwapProcessesForRedirect(
95 ResourceContext* resource_context, const GURL& current_url,
96 const GURL& new_url) {
97 return false;
100 bool ContentBrowserClient::ShouldAssignSiteForURL(const GURL& url) {
101 return true;
104 std::string ContentBrowserClient::GetCanonicalEncodingNameByAliasName(
105 const std::string& alias_name) {
106 return std::string();
109 std::string ContentBrowserClient::GetApplicationLocale() {
110 return "en-US";
113 std::string ContentBrowserClient::GetAcceptLangs(BrowserContext* context) {
114 return std::string();
117 const gfx::ImageSkia* ContentBrowserClient::GetDefaultFavicon() {
118 static gfx::ImageSkia* empty = new gfx::ImageSkia();
119 return empty;
122 bool ContentBrowserClient::AllowAppCache(const GURL& manifest_url,
123 const GURL& first_party,
124 ResourceContext* context) {
125 return true;
128 bool ContentBrowserClient::AllowServiceWorker(const GURL& scope,
129 const GURL& document_url,
130 content::ResourceContext* context,
131 int render_process_id,
132 int render_frame_id) {
133 return true;
136 bool ContentBrowserClient::AllowGetCookie(const GURL& url,
137 const GURL& first_party,
138 const net::CookieList& cookie_list,
139 ResourceContext* context,
140 int render_process_id,
141 int render_frame_id) {
142 return true;
145 bool ContentBrowserClient::AllowSetCookie(const GURL& url,
146 const GURL& first_party,
147 const std::string& cookie_line,
148 ResourceContext* context,
149 int render_process_id,
150 int render_frame_id,
151 net::CookieOptions* options) {
152 return true;
155 bool ContentBrowserClient::AllowSaveLocalState(ResourceContext* context) {
156 return true;
159 bool ContentBrowserClient::AllowWorkerDatabase(
160 const GURL& url,
161 const base::string16& name,
162 const base::string16& display_name,
163 unsigned long estimated_size,
164 ResourceContext* context,
165 const std::vector<std::pair<int, int> >& render_frames) {
166 return true;
169 void ContentBrowserClient::AllowWorkerFileSystem(
170 const GURL& url,
171 ResourceContext* context,
172 const std::vector<std::pair<int, int> >& render_frames,
173 base::Callback<void(bool)> callback) {
174 callback.Run(true);
177 bool ContentBrowserClient::AllowWorkerIndexedDB(
178 const GURL& url,
179 const base::string16& name,
180 ResourceContext* context,
181 const std::vector<std::pair<int, int> >& render_frames) {
182 return true;
185 #if defined(ENABLE_WEBRTC)
186 bool ContentBrowserClient::AllowWebRTCIdentityCache(const GURL& url,
187 const GURL& first_party_url,
188 ResourceContext* context) {
189 return true;
191 #endif // defined(ENABLE_WEBRTC)
193 QuotaPermissionContext* ContentBrowserClient::CreateQuotaPermissionContext() {
194 return nullptr;
197 void ContentBrowserClient::SelectClientCertificate(
198 WebContents* web_contents,
199 net::SSLCertRequestInfo* cert_request_info,
200 scoped_ptr<ClientCertificateDelegate> delegate) {
203 net::URLRequestContext* ContentBrowserClient::OverrideRequestContextForURL(
204 const GURL& url, ResourceContext* context) {
205 return nullptr;
208 std::string ContentBrowserClient::GetStoragePartitionIdForSite(
209 BrowserContext* browser_context,
210 const GURL& site) {
211 return std::string();
214 bool ContentBrowserClient::IsValidStoragePartitionId(
215 BrowserContext* browser_context,
216 const std::string& partition_id) {
217 // Since the GetStoragePartitionIdForChildProcess() only generates empty
218 // strings, we should only ever see empty strings coming back.
219 return partition_id.empty();
222 void ContentBrowserClient::GetStoragePartitionConfigForSite(
223 BrowserContext* browser_context,
224 const GURL& site,
225 bool can_be_default,
226 std::string* partition_domain,
227 std::string* partition_name,
228 bool* in_memory) {
229 partition_domain->clear();
230 partition_name->clear();
231 *in_memory = false;
234 MediaObserver* ContentBrowserClient::GetMediaObserver() {
235 return nullptr;
238 PlatformNotificationService*
239 ContentBrowserClient::GetPlatformNotificationService() {
240 return nullptr;
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_render_view_id,
257 int opener_render_frame_id,
258 bool* no_javascript_access) {
259 *no_javascript_access = false;
260 return true;
263 SpeechRecognitionManagerDelegate*
264 ContentBrowserClient::CreateSpeechRecognitionManagerDelegate() {
265 return nullptr;
268 net::NetLog* ContentBrowserClient::GetNetLog() {
269 return nullptr;
272 AccessTokenStore* ContentBrowserClient::CreateAccessTokenStore() {
273 return nullptr;
276 bool ContentBrowserClient::IsFastShutdownPossible() {
277 return true;
280 base::FilePath ContentBrowserClient::GetDefaultDownloadDirectory() {
281 return base::FilePath();
284 std::string ContentBrowserClient::GetDefaultDownloadName() {
285 return std::string();
288 BrowserPpapiHost*
289 ContentBrowserClient::GetExternalBrowserPpapiHost(int plugin_process_id) {
290 return nullptr;
293 bool ContentBrowserClient::AllowPepperSocketAPI(
294 BrowserContext* browser_context,
295 const GURL& url,
296 bool private_api,
297 const SocketPermissionRequest* params) {
298 return false;
301 ui::SelectFilePolicy* ContentBrowserClient::CreateSelectFilePolicy(
302 WebContents* web_contents) {
303 return nullptr;
306 LocationProvider* ContentBrowserClient::OverrideSystemLocationProvider() {
307 return nullptr;
310 DevToolsManagerDelegate* ContentBrowserClient::GetDevToolsManagerDelegate() {
311 return nullptr;
314 TracingDelegate* ContentBrowserClient::GetTracingDelegate() {
315 return nullptr;
318 bool ContentBrowserClient::IsNPAPIEnabled() {
319 return false;
322 bool ContentBrowserClient::IsPluginAllowedToCallRequestOSFileHandle(
323 BrowserContext* browser_context,
324 const GURL& url) {
325 return false;
328 bool ContentBrowserClient::IsPluginAllowedToUseDevChannelAPIs(
329 BrowserContext* browser_context,
330 const GURL& url) {
331 return false;
334 PresentationServiceDelegate*
335 ContentBrowserClient::GetPresentationServiceDelegate(
336 WebContents* web_contents) {
337 return nullptr;
340 void ContentBrowserClient::OpenURL(
341 content::BrowserContext* browser_context,
342 const content::OpenURLParams& params,
343 const base::Callback<void(content::WebContents*)>& callback) {
344 callback.Run(nullptr);
347 #if defined(OS_WIN)
348 const wchar_t* ContentBrowserClient::GetResourceDllName() {
349 return nullptr;
352 base::string16 ContentBrowserClient::GetAppContainerSidForSandboxType(
353 int sandbox_type) const {
354 // Embedders should override this method and return different SIDs for each
355 // sandbox type. Note: All content level tests will run child processes in the
356 // same AppContainer.
357 return base::string16(
358 L"S-1-15-2-3251537155-1984446955-2931258699-841473695-1938553385-"
359 L"924012148-129201922");
361 #endif
363 #if defined(VIDEO_HOLE)
364 ExternalVideoSurfaceContainer*
365 ContentBrowserClient::OverrideCreateExternalVideoSurfaceContainer(
366 WebContents* web_contents) {
367 NOTREACHED() << "Hole-punching is not supported. See crbug.com/469348.";
368 return nullptr;
370 #endif
372 } // namespace content