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