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