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::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_frame_id) { 125 return true; 126 } 127 128 bool 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_frame_id, 134 net::CookieOptions* options) { 135 return true; 136 } 137 138 bool ContentBrowserClient::AllowSaveLocalState(ResourceContext* context) { 139 return true; 140 } 141 142 bool ContentBrowserClient::AllowWorkerDatabase( 143 const GURL& url, 144 const base::string16& name, 145 const base::string16& display_name, 146 unsigned long estimated_size, 147 ResourceContext* context, 148 const std::vector<std::pair<int, int> >& render_frames) { 149 return true; 150 } 151 152 bool ContentBrowserClient::AllowWorkerFileSystem( 153 const GURL& url, 154 ResourceContext* context, 155 const std::vector<std::pair<int, int> >& render_frames) { 156 return true; 157 } 158 159 bool ContentBrowserClient::AllowWorkerIndexedDB( 160 const GURL& url, 161 const base::string16& name, 162 ResourceContext* context, 163 const std::vector<std::pair<int, int> >& render_frames) { 164 return true; 165 } 166 167 QuotaPermissionContext* ContentBrowserClient::CreateQuotaPermissionContext() { 168 return NULL; 169 } 170 171 net::URLRequestContext* ContentBrowserClient::OverrideRequestContextForURL( 172 const GURL& url, ResourceContext* context) { 173 return NULL; 174 } 175 176 std::string ContentBrowserClient::GetStoragePartitionIdForSite( 177 BrowserContext* browser_context, 178 const GURL& site) { 179 return std::string(); 180 } 181 182 bool 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 190 void 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 202 MediaObserver* ContentBrowserClient::GetMediaObserver() { 203 return NULL; 204 } 205 206 blink::WebNotificationPresenter::Permission 207 ContentBrowserClient::CheckDesktopNotificationPermission( 208 const GURL& source_origin, 209 ResourceContext* context, 210 int render_process_id) { 211 return blink::WebNotificationPresenter::PermissionAllowed; 212 } 213 214 void ContentBrowserClient::RequestGeolocationPermission( 215 WebContents* web_contents, 216 int bridge_id, 217 const GURL& requesting_frame, 218 bool user_gesture, 219 base::Callback<void(bool)> result_callback, 220 base::Closure* cancel_callback) { 221 result_callback.Run(true); 222 } 223 224 void ContentBrowserClient::RequestMidiSysExPermission( 225 WebContents* web_contents, 226 int bridge_id, 227 const GURL& requesting_frame, 228 bool user_gesture, 229 base::Callback<void(bool)> result_callback, 230 base::Closure* cancel_callback) { 231 result_callback.Run(true); 232 } 233 234 void ContentBrowserClient::RequestProtectedMediaIdentifierPermission( 235 WebContents* web_contents, 236 const GURL& origin, 237 base::Callback<void(bool)> result_callback, 238 base::Closure* cancel_callback) { 239 result_callback.Run(true); 240 } 241 242 bool ContentBrowserClient::CanCreateWindow( 243 const GURL& opener_url, 244 const GURL& opener_top_level_frame_url, 245 const GURL& source_origin, 246 WindowContainerType container_type, 247 const GURL& target_url, 248 const Referrer& referrer, 249 WindowOpenDisposition disposition, 250 const blink::WebWindowFeatures& features, 251 bool user_gesture, 252 bool opener_suppressed, 253 ResourceContext* context, 254 int render_process_id, 255 int opener_id, 256 bool* no_javascript_access) { 257 *no_javascript_access = false; 258 return true; 259 } 260 261 std::string ContentBrowserClient::GetWorkerProcessTitle( 262 const GURL& url, ResourceContext* context) { 263 return std::string(); 264 } 265 266 SpeechRecognitionManagerDelegate* 267 ContentBrowserClient::GetSpeechRecognitionManagerDelegate() { 268 return NULL; 269 } 270 271 net::NetLog* ContentBrowserClient::GetNetLog() { 272 return NULL; 273 } 274 275 AccessTokenStore* ContentBrowserClient::CreateAccessTokenStore() { 276 return NULL; 277 } 278 279 bool ContentBrowserClient::IsFastShutdownPossible() { 280 return true; 281 } 282 283 base::FilePath ContentBrowserClient::GetDefaultDownloadDirectory() { 284 return base::FilePath(); 285 } 286 287 std::string ContentBrowserClient::GetDefaultDownloadName() { 288 return std::string(); 289 } 290 291 BrowserPpapiHost* 292 ContentBrowserClient::GetExternalBrowserPpapiHost(int plugin_process_id) { 293 return NULL; 294 } 295 296 bool ContentBrowserClient::AllowPepperSocketAPI( 297 BrowserContext* browser_context, 298 const GURL& url, 299 bool private_api, 300 const SocketPermissionRequest* params) { 301 return false; 302 } 303 304 ui::SelectFilePolicy* ContentBrowserClient::CreateSelectFilePolicy( 305 WebContents* web_contents) { 306 return NULL; 307 } 308 309 LocationProvider* ContentBrowserClient::OverrideSystemLocationProvider() { 310 return NULL; 311 } 312 313 VibrationProvider* ContentBrowserClient::OverrideVibrationProvider() { 314 return NULL; 315 } 316 317 DevToolsManagerDelegate* ContentBrowserClient::GetDevToolsManagerDelegate() { 318 return NULL; 319 } 320 321 bool ContentBrowserClient::IsPluginAllowedToCallRequestOSFileHandle( 322 BrowserContext* browser_context, 323 const GURL& url) { 324 return false; 325 } 326 327 bool ContentBrowserClient::IsPluginAllowedToUseDevChannelAPIs( 328 BrowserContext* browser_context, 329 const GURL& url) { 330 return false; 331 } 332 333 net::CookieStore* ContentBrowserClient::OverrideCookieStoreForRenderProcess( 334 int render_process_id) { 335 return NULL; 336 } 337 338 #if defined(OS_WIN) 339 const wchar_t* ContentBrowserClient::GetResourceDllName() { 340 return NULL; 341 } 342 #endif 343 344 #if defined(VIDEO_HOLE) 345 ExternalVideoSurfaceContainer* 346 ContentBrowserClient::OverrideCreateExternalVideoSurfaceContainer( 347 WebContents* web_contents) { 348 return NULL; 349 } 350 #endif 351 352 } // namespace content 353