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