Re-subimission of https://codereview.chromium.org/1041213003/
[chromium-blink-merge.git] / content / public / browser / content_browser_client.cc
blobe50b9636bf2fe33e2911c83b5703962a229b4346
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 "ui/gfx/image/image_skia.h"
10 #include "url/gurl.h"
12 namespace content {
14 BrowserMainParts* ContentBrowserClient::CreateBrowserMainParts(
15 const MainFunctionParams& parameters) {
16 return nullptr;
19 WebContentsViewDelegate* ContentBrowserClient::GetWebContentsViewDelegate(
20 WebContents* web_contents) {
21 return nullptr;
24 GURL ContentBrowserClient::GetEffectiveURL(BrowserContext* browser_context,
25 const GURL& url) {
26 return url;
29 bool ContentBrowserClient::ShouldUseProcessPerSite(
30 BrowserContext* browser_context, const GURL& effective_url) {
31 return false;
34 net::URLRequestContextGetter* ContentBrowserClient::CreateRequestContext(
35 BrowserContext* browser_context,
36 ProtocolHandlerMap* protocol_handlers,
37 URLRequestInterceptorScopedVector request_interceptors) {
38 return nullptr;
41 net::URLRequestContextGetter*
42 ContentBrowserClient::CreateRequestContextForStoragePartition(
43 BrowserContext* browser_context,
44 const base::FilePath& partition_path,
45 bool in_memory,
46 ProtocolHandlerMap* protocol_handlers,
47 URLRequestInterceptorScopedVector request_interceptors) {
48 return nullptr;
51 bool ContentBrowserClient::IsHandledURL(const GURL& url) {
52 return false;
55 bool ContentBrowserClient::CanCommitURL(RenderProcessHost* process_host,
56 const GURL& site_url) {
57 return true;
60 bool ContentBrowserClient::ShouldAllowOpenURL(SiteInstance* site_instance,
61 const GURL& url) {
62 return true;
65 bool ContentBrowserClient::IsSuitableHost(RenderProcessHost* process_host,
66 const GURL& site_url) {
67 return true;
70 bool ContentBrowserClient::MayReuseHost(RenderProcessHost* process_host) {
71 return true;
74 bool ContentBrowserClient::ShouldTryToUseExistingProcessHost(
75 BrowserContext* browser_context, const GURL& url) {
76 return false;
79 bool ContentBrowserClient::ShouldSwapBrowsingInstancesForNavigation(
80 SiteInstance* site_instance,
81 const GURL& current_url,
82 const GURL& new_url) {
83 return false;
86 bool ContentBrowserClient::ShouldSwapProcessesForRedirect(
87 ResourceContext* resource_context, const GURL& current_url,
88 const GURL& new_url) {
89 return false;
92 bool ContentBrowserClient::ShouldAssignSiteForURL(const GURL& url) {
93 return true;
96 std::string ContentBrowserClient::GetCanonicalEncodingNameByAliasName(
97 const std::string& alias_name) {
98 return std::string();
101 std::string ContentBrowserClient::GetApplicationLocale() {
102 return "en-US";
105 std::string ContentBrowserClient::GetAcceptLangs(BrowserContext* context) {
106 return std::string();
109 const gfx::ImageSkia* ContentBrowserClient::GetDefaultFavicon() {
110 static gfx::ImageSkia* empty = new gfx::ImageSkia();
111 return empty;
114 bool ContentBrowserClient::AllowAppCache(const GURL& manifest_url,
115 const GURL& first_party,
116 ResourceContext* context) {
117 return true;
120 bool ContentBrowserClient::AllowServiceWorker(
121 const GURL& scope,
122 const GURL& document_url,
123 content::ResourceContext* context) {
124 return true;
127 bool ContentBrowserClient::AllowGetCookie(const GURL& url,
128 const GURL& first_party,
129 const net::CookieList& cookie_list,
130 ResourceContext* context,
131 int render_process_id,
132 int render_frame_id) {
133 return true;
136 bool ContentBrowserClient::AllowSetCookie(const GURL& url,
137 const GURL& first_party,
138 const std::string& cookie_line,
139 ResourceContext* context,
140 int render_process_id,
141 int render_frame_id,
142 net::CookieOptions* options) {
143 return true;
146 bool ContentBrowserClient::AllowSaveLocalState(ResourceContext* context) {
147 return true;
150 bool ContentBrowserClient::AllowWorkerDatabase(
151 const GURL& url,
152 const base::string16& name,
153 const base::string16& display_name,
154 unsigned long estimated_size,
155 ResourceContext* context,
156 const std::vector<std::pair<int, int> >& render_frames) {
157 return true;
160 void ContentBrowserClient::AllowWorkerFileSystem(
161 const GURL& url,
162 ResourceContext* context,
163 const std::vector<std::pair<int, int> >& render_frames,
164 base::Callback<void(bool)> callback) {
165 callback.Run(true);
168 bool ContentBrowserClient::AllowWorkerIndexedDB(
169 const GURL& url,
170 const base::string16& name,
171 ResourceContext* context,
172 const std::vector<std::pair<int, int> >& render_frames) {
173 return true;
176 QuotaPermissionContext* ContentBrowserClient::CreateQuotaPermissionContext() {
177 return nullptr;
180 void ContentBrowserClient::SelectClientCertificate(
181 WebContents* web_contents,
182 net::SSLCertRequestInfo* cert_request_info,
183 scoped_ptr<ClientCertificateDelegate> delegate) {
186 net::URLRequestContext* ContentBrowserClient::OverrideRequestContextForURL(
187 const GURL& url, ResourceContext* context) {
188 return nullptr;
191 std::string ContentBrowserClient::GetStoragePartitionIdForSite(
192 BrowserContext* browser_context,
193 const GURL& site) {
194 return std::string();
197 bool ContentBrowserClient::IsValidStoragePartitionId(
198 BrowserContext* browser_context,
199 const std::string& partition_id) {
200 // Since the GetStoragePartitionIdForChildProcess() only generates empty
201 // strings, we should only ever see empty strings coming back.
202 return partition_id.empty();
205 void ContentBrowserClient::GetStoragePartitionConfigForSite(
206 BrowserContext* browser_context,
207 const GURL& site,
208 bool can_be_default,
209 std::string* partition_domain,
210 std::string* partition_name,
211 bool* in_memory) {
212 partition_domain->clear();
213 partition_name->clear();
214 *in_memory = false;
217 MediaObserver* ContentBrowserClient::GetMediaObserver() {
218 return nullptr;
221 PlatformNotificationService*
222 ContentBrowserClient::GetPlatformNotificationService() {
223 return nullptr;
226 bool ContentBrowserClient::CanCreateWindow(
227 const GURL& opener_url,
228 const GURL& opener_top_level_frame_url,
229 const GURL& source_origin,
230 WindowContainerType container_type,
231 const GURL& target_url,
232 const Referrer& referrer,
233 WindowOpenDisposition disposition,
234 const blink::WebWindowFeatures& features,
235 bool user_gesture,
236 bool opener_suppressed,
237 ResourceContext* context,
238 int render_process_id,
239 int opener_id,
240 bool* no_javascript_access) {
241 *no_javascript_access = false;
242 return true;
245 SpeechRecognitionManagerDelegate*
246 ContentBrowserClient::CreateSpeechRecognitionManagerDelegate() {
247 return nullptr;
250 net::NetLog* ContentBrowserClient::GetNetLog() {
251 return nullptr;
254 AccessTokenStore* ContentBrowserClient::CreateAccessTokenStore() {
255 return nullptr;
258 bool ContentBrowserClient::IsFastShutdownPossible() {
259 return true;
262 base::FilePath ContentBrowserClient::GetDefaultDownloadDirectory() {
263 return base::FilePath();
266 std::string ContentBrowserClient::GetDefaultDownloadName() {
267 return std::string();
270 BrowserPpapiHost*
271 ContentBrowserClient::GetExternalBrowserPpapiHost(int plugin_process_id) {
272 return nullptr;
275 bool ContentBrowserClient::AllowPepperSocketAPI(
276 BrowserContext* browser_context,
277 const GURL& url,
278 bool private_api,
279 const SocketPermissionRequest* params) {
280 return false;
283 ui::SelectFilePolicy* ContentBrowserClient::CreateSelectFilePolicy(
284 WebContents* web_contents) {
285 return nullptr;
288 LocationProvider* ContentBrowserClient::OverrideSystemLocationProvider() {
289 return nullptr;
292 DevToolsManagerDelegate* ContentBrowserClient::GetDevToolsManagerDelegate() {
293 return nullptr;
296 TracingDelegate* ContentBrowserClient::GetTracingDelegate() {
297 return nullptr;
300 bool ContentBrowserClient::IsPluginAllowedToCallRequestOSFileHandle(
301 BrowserContext* browser_context,
302 const GURL& url) {
303 return false;
306 bool ContentBrowserClient::IsPluginAllowedToUseDevChannelAPIs(
307 BrowserContext* browser_context,
308 const GURL& url) {
309 return false;
312 bool ContentBrowserClient::CheckMediaAccessPermission(
313 BrowserContext* browser_context,
314 const GURL& security_origin,
315 MediaStreamType type) {
316 return false;
319 PresentationServiceDelegate*
320 ContentBrowserClient::GetPresentationServiceDelegate(
321 WebContents* web_contents) {
322 return nullptr;
325 void ContentBrowserClient::OpenURL(
326 content::BrowserContext* browser_context,
327 const content::OpenURLParams& params,
328 const base::Callback<void(content::WebContents*)>& callback) {
329 callback.Run(nullptr);
332 #if defined(OS_WIN)
333 const wchar_t* ContentBrowserClient::GetResourceDllName() {
334 return nullptr;
336 #endif
338 #if defined(VIDEO_HOLE)
339 ExternalVideoSurfaceContainer*
340 ContentBrowserClient::OverrideCreateExternalVideoSurfaceContainer(
341 WebContents* web_contents) {
342 return nullptr;
344 #endif
346 } // namespace content