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