OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/chrome_content_browser_client.h" | 5 #include "chrome/browser/chrome_content_browser_client.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 30 matching lines...) Expand all Loading... |
41 #include "chrome/browser/budget_service/budget_service_impl.h" | 41 #include "chrome/browser/budget_service/budget_service_impl.h" |
42 #include "chrome/browser/character_encoding.h" | 42 #include "chrome/browser/character_encoding.h" |
43 #include "chrome/browser/chrome_content_browser_client_parts.h" | 43 #include "chrome/browser/chrome_content_browser_client_parts.h" |
44 #include "chrome/browser/chrome_net_benchmarking_message_filter.h" | 44 #include "chrome/browser/chrome_net_benchmarking_message_filter.h" |
45 #include "chrome/browser/chrome_quota_permission_context.h" | 45 #include "chrome/browser/chrome_quota_permission_context.h" |
46 #include "chrome/browser/content_settings/cookie_settings_factory.h" | 46 #include "chrome/browser/content_settings/cookie_settings_factory.h" |
47 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 47 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
48 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 48 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
49 #include "chrome/browser/defaults.h" | 49 #include "chrome/browser/defaults.h" |
50 #include "chrome/browser/download/download_prefs.h" | 50 #include "chrome/browser/download/download_prefs.h" |
51 #include "chrome/browser/engagement/site_engagement_eviction_policy.h" | |
52 #include "chrome/browser/field_trial_recorder.h" | 51 #include "chrome/browser/field_trial_recorder.h" |
53 #include "chrome/browser/font_family_cache.h" | 52 #include "chrome/browser/font_family_cache.h" |
54 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" | 53 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" |
55 #include "chrome/browser/memory/chrome_memory_coordinator_delegate.h" | 54 #include "chrome/browser/memory/chrome_memory_coordinator_delegate.h" |
56 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h" | 55 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h" |
57 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h" | 56 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h" |
58 #include "chrome/browser/notifications/platform_notification_service_impl.h" | 57 #include "chrome/browser/notifications/platform_notification_service_impl.h" |
59 #include "chrome/browser/page_load_metrics/metrics_navigation_throttle.h" | 58 #include "chrome/browser/page_load_metrics/metrics_navigation_throttle.h" |
60 #include "chrome/browser/password_manager/chrome_password_manager_client.h" | 59 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
61 #include "chrome/browser/payments/payment_request_impl.h" | 60 #include "chrome/browser/payments/payment_request_impl.h" |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 #if BUILDFLAG(ENABLE_PLUGINS) | 395 #if BUILDFLAG(ENABLE_PLUGINS) |
397 using plugins::ChromeContentBrowserClientPluginsPart; | 396 using plugins::ChromeContentBrowserClientPluginsPart; |
398 #endif | 397 #endif |
399 | 398 |
400 namespace { | 399 namespace { |
401 | 400 |
402 // Cached version of the locale so we can return the locale on the I/O | 401 // Cached version of the locale so we can return the locale on the I/O |
403 // thread. | 402 // thread. |
404 base::LazyInstance<std::string> g_io_thread_application_locale; | 403 base::LazyInstance<std::string> g_io_thread_application_locale; |
405 | 404 |
| 405 const storage::QuotaSettings* g_default_quota_settings; |
| 406 |
406 #if BUILDFLAG(ENABLE_PLUGINS) | 407 #if BUILDFLAG(ENABLE_PLUGINS) |
407 // TODO(teravest): Add renderer-side API-specific checking for these APIs so | 408 // TODO(teravest): Add renderer-side API-specific checking for these APIs so |
408 // that blanket permission isn't granted to all dev channel APIs for these. | 409 // that blanket permission isn't granted to all dev channel APIs for these. |
409 // http://crbug.com/386743 | 410 // http://crbug.com/386743 |
410 const char* const kPredefinedAllowedDevChannelOrigins[] = { | 411 const char* const kPredefinedAllowedDevChannelOrigins[] = { |
411 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", // see crbug.com/383937 | 412 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", // see crbug.com/383937 |
412 "4EB74897CB187C7633357C2FE832E0AD6A44883A" // see crbug.com/383937 | 413 "4EB74897CB187C7633357C2FE832E0AD6A44883A" // see crbug.com/383937 |
413 }; | 414 }; |
414 | 415 |
415 const char* const kPredefinedAllowedFileHandleOrigins[] = { | 416 const char* const kPredefinedAllowedFileHandleOrigins[] = { |
(...skipping 1734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2150 #endif | 2151 #endif |
2151 | 2152 |
2152 return NULL; | 2153 return NULL; |
2153 } | 2154 } |
2154 | 2155 |
2155 QuotaPermissionContext* | 2156 QuotaPermissionContext* |
2156 ChromeContentBrowserClient::CreateQuotaPermissionContext() { | 2157 ChromeContentBrowserClient::CreateQuotaPermissionContext() { |
2157 return new ChromeQuotaPermissionContext(); | 2158 return new ChromeQuotaPermissionContext(); |
2158 } | 2159 } |
2159 | 2160 |
2160 std::unique_ptr<storage::QuotaEvictionPolicy> | 2161 void ChromeContentBrowserClient::GetQuotaSettings( |
2161 ChromeContentBrowserClient::GetTemporaryStorageEvictionPolicy( | 2162 content::BrowserContext* context, |
2162 content::BrowserContext* context) { | 2163 content::StoragePartition* partition, |
2163 return SiteEngagementEvictionPolicy::IsEnabled() | 2164 const storage::OptionalQuotaSettingsCallback& callback) { |
2164 ? base::MakeUnique<SiteEngagementEvictionPolicy>(context) | 2165 if (g_default_quota_settings) { |
2165 : nullptr; | 2166 // For debugging tests harness can inject settings. |
| 2167 callback.Run(*g_default_quota_settings); |
| 2168 return; |
| 2169 } |
| 2170 content::BrowserThread::PostTaskAndReplyWithResult( |
| 2171 content::BrowserThread::FILE, FROM_HERE, |
| 2172 base::Bind(&storage::CalculateNominalDynamicSettings, |
| 2173 partition->GetPath(), context->IsOffTheRecord()), |
| 2174 callback); |
2166 } | 2175 } |
2167 | 2176 |
2168 void ChromeContentBrowserClient::AllowCertificateError( | 2177 void ChromeContentBrowserClient::AllowCertificateError( |
2169 content::WebContents* web_contents, | 2178 content::WebContents* web_contents, |
2170 int cert_error, | 2179 int cert_error, |
2171 const net::SSLInfo& ssl_info, | 2180 const net::SSLInfo& ssl_info, |
2172 const GURL& request_url, | 2181 const GURL& request_url, |
2173 ResourceType resource_type, | 2182 ResourceType resource_type, |
2174 bool overridable, | 2183 bool overridable, |
2175 bool strict_enforcement, | 2184 bool strict_enforcement, |
(...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3341 GetBrowserSchedulerWorkerPoolParamsFromVariations(); | 3350 GetBrowserSchedulerWorkerPoolParamsFromVariations(); |
3342 *index_to_traits_callback = base::Bind(&task_scheduler_util::initialization:: | 3351 *index_to_traits_callback = base::Bind(&task_scheduler_util::initialization:: |
3343 BrowserWorkerPoolIndexForTraits); | 3352 BrowserWorkerPoolIndexForTraits); |
3344 } | 3353 } |
3345 | 3354 |
3346 void ChromeContentBrowserClient:: | 3355 void ChromeContentBrowserClient:: |
3347 PerformExperimentalTaskSchedulerRedirections() { | 3356 PerformExperimentalTaskSchedulerRedirections() { |
3348 task_scheduler_util::variations:: | 3357 task_scheduler_util::variations:: |
3349 MaybePerformBrowserTaskSchedulerRedirection(); | 3358 MaybePerformBrowserTaskSchedulerRedirection(); |
3350 } | 3359 } |
| 3360 |
| 3361 //static |
| 3362 void ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting( |
| 3363 const storage::QuotaSettings* settings) { |
| 3364 g_default_quota_settings = settings; |
| 3365 } |
OLD | NEW |