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::ShouldAllowOpenURL(SiteInstance* site_instance, 64 const GURL& url) { 65 return true; 66 } 67 68 bool ContentBrowserClient::IsSuitableHost(RenderProcessHost* process_host, 69 const GURL& site_url) { 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 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_view_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_view_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_views) { 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_views) { 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_views) { 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 bool 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 blink::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 234 std::string ContentBrowserClient::GetWorkerProcessTitle( 235 const GURL& url, ResourceContext* context) { 236 return std::string(); 237 } 238 239 SpeechRecognitionManagerDelegate* 240 ContentBrowserClient::GetSpeechRecognitionManagerDelegate() { 241 return NULL; 242 } 243 244 net::NetLog* ContentBrowserClient::GetNetLog() { 245 return NULL; 246 } 247 248 AccessTokenStore* ContentBrowserClient::CreateAccessTokenStore() { 249 return NULL; 250 } 251 252 bool ContentBrowserClient::IsFastShutdownPossible() { 253 return true; 254 } 255 256 base::FilePath ContentBrowserClient::GetDefaultDownloadDirectory() { 257 return base::FilePath(); 258 } 259 260 std::string ContentBrowserClient::GetDefaultDownloadName() { 261 return std::string(); 262 } 263 264 BrowserPpapiHost* 265 ContentBrowserClient::GetExternalBrowserPpapiHost(int plugin_process_id) { 266 return NULL; 267 } 268 269 bool ContentBrowserClient::SupportsBrowserPlugin( 270 BrowserContext* browser_context, const GURL& site_url) { 271 return false; 272 } 273 274 bool ContentBrowserClient::AllowPepperSocketAPI( 275 BrowserContext* browser_context, 276 const GURL& url, 277 bool private_api, 278 const SocketPermissionRequest* params) { 279 return false; 280 } 281 282 ui::SelectFilePolicy* ContentBrowserClient::CreateSelectFilePolicy( 283 WebContents* web_contents) { 284 return NULL; 285 } 286 287 LocationProvider* ContentBrowserClient::OverrideSystemLocationProvider() { 288 return NULL; 289 } 290 291 VibrationProvider* ContentBrowserClient::OverrideVibrationProvider() { 292 return NULL; 293 } 294 295 #if defined(OS_WIN) 296 const wchar_t* ContentBrowserClient::GetResourceDllName() { 297 return NULL; 298 } 299 #endif 300 301 bool ContentBrowserClient::IsPluginAllowedToCallRequestOSFileHandle( 302 content::BrowserContext* browser_context, 303 const GURL& url) { 304 return false; 305 } 306 307 bool ContentBrowserClient::IsPluginAllowedToUseDevChannelAPIs() { 308 return false; 309 } 310 311 } // namespace content 312