| 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" |
| 51 #include "chrome/browser/field_trial_recorder.h" | 52 #include "chrome/browser/field_trial_recorder.h" |
| 52 #include "chrome/browser/font_family_cache.h" | 53 #include "chrome/browser/font_family_cache.h" |
| 53 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" | 54 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" |
| 54 #include "chrome/browser/memory/chrome_memory_coordinator_delegate.h" | 55 #include "chrome/browser/memory/chrome_memory_coordinator_delegate.h" |
| 55 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h" | 56 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h" |
| 56 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h" | 57 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h" |
| 57 #include "chrome/browser/notifications/platform_notification_service_impl.h" | 58 #include "chrome/browser/notifications/platform_notification_service_impl.h" |
| 58 #include "chrome/browser/page_load_metrics/metrics_navigation_throttle.h" | 59 #include "chrome/browser/page_load_metrics/metrics_navigation_throttle.h" |
| 59 #include "chrome/browser/password_manager/chrome_password_manager_client.h" | 60 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
| 60 #include "chrome/browser/payments/payment_request_impl.h" | 61 #include "chrome/browser/payments/payment_request_impl.h" |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 #if BUILDFLAG(ENABLE_PLUGINS) | 399 #if BUILDFLAG(ENABLE_PLUGINS) |
| 399 using plugins::ChromeContentBrowserClientPluginsPart; | 400 using plugins::ChromeContentBrowserClientPluginsPart; |
| 400 #endif | 401 #endif |
| 401 | 402 |
| 402 namespace { | 403 namespace { |
| 403 | 404 |
| 404 // Cached version of the locale so we can return the locale on the I/O | 405 // Cached version of the locale so we can return the locale on the I/O |
| 405 // thread. | 406 // thread. |
| 406 base::LazyInstance<std::string> g_io_thread_application_locale; | 407 base::LazyInstance<std::string> g_io_thread_application_locale; |
| 407 | 408 |
| 408 const storage::QuotaSettings* g_default_quota_settings; | |
| 409 | |
| 410 #if BUILDFLAG(ENABLE_PLUGINS) | 409 #if BUILDFLAG(ENABLE_PLUGINS) |
| 411 // TODO(teravest): Add renderer-side API-specific checking for these APIs so | 410 // TODO(teravest): Add renderer-side API-specific checking for these APIs so |
| 412 // that blanket permission isn't granted to all dev channel APIs for these. | 411 // that blanket permission isn't granted to all dev channel APIs for these. |
| 413 // http://crbug.com/386743 | 412 // http://crbug.com/386743 |
| 414 const char* const kPredefinedAllowedDevChannelOrigins[] = { | 413 const char* const kPredefinedAllowedDevChannelOrigins[] = { |
| 415 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", // see crbug.com/383937 | 414 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", // see crbug.com/383937 |
| 416 "4EB74897CB187C7633357C2FE832E0AD6A44883A" // see crbug.com/383937 | 415 "4EB74897CB187C7633357C2FE832E0AD6A44883A" // see crbug.com/383937 |
| 417 }; | 416 }; |
| 418 | 417 |
| 419 const char* const kPredefinedAllowedFileHandleOrigins[] = { | 418 const char* const kPredefinedAllowedFileHandleOrigins[] = { |
| (...skipping 1737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2157 #endif | 2156 #endif |
| 2158 | 2157 |
| 2159 return NULL; | 2158 return NULL; |
| 2160 } | 2159 } |
| 2161 | 2160 |
| 2162 QuotaPermissionContext* | 2161 QuotaPermissionContext* |
| 2163 ChromeContentBrowserClient::CreateQuotaPermissionContext() { | 2162 ChromeContentBrowserClient::CreateQuotaPermissionContext() { |
| 2164 return new ChromeQuotaPermissionContext(); | 2163 return new ChromeQuotaPermissionContext(); |
| 2165 } | 2164 } |
| 2166 | 2165 |
| 2167 void ChromeContentBrowserClient::GetQuotaSettings( | 2166 std::unique_ptr<storage::QuotaEvictionPolicy> |
| 2168 content::BrowserContext* context, | 2167 ChromeContentBrowserClient::GetTemporaryStorageEvictionPolicy( |
| 2169 content::StoragePartition* partition, | 2168 content::BrowserContext* context) { |
| 2170 const storage::OptionalQuotaSettingsCallback& callback) { | 2169 return SiteEngagementEvictionPolicy::IsEnabled() |
| 2171 if (g_default_quota_settings) { | 2170 ? base::MakeUnique<SiteEngagementEvictionPolicy>(context) |
| 2172 // For debugging tests harness can inject settings. | 2171 : nullptr; |
| 2173 callback.Run(*g_default_quota_settings); | |
| 2174 return; | |
| 2175 } | |
| 2176 content::BrowserThread::PostTaskAndReplyWithResult( | |
| 2177 content::BrowserThread::FILE, FROM_HERE, | |
| 2178 base::Bind(&storage::CalculateNominalDynamicSettings, | |
| 2179 partition->GetPath(), context->IsOffTheRecord()), | |
| 2180 callback); | |
| 2181 } | 2172 } |
| 2182 | 2173 |
| 2183 void ChromeContentBrowserClient::AllowCertificateError( | 2174 void ChromeContentBrowserClient::AllowCertificateError( |
| 2184 content::WebContents* web_contents, | 2175 content::WebContents* web_contents, |
| 2185 int cert_error, | 2176 int cert_error, |
| 2186 const net::SSLInfo& ssl_info, | 2177 const net::SSLInfo& ssl_info, |
| 2187 const GURL& request_url, | 2178 const GURL& request_url, |
| 2188 ResourceType resource_type, | 2179 ResourceType resource_type, |
| 2189 bool overridable, | 2180 bool overridable, |
| 2190 bool strict_enforcement, | 2181 bool strict_enforcement, |
| (...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3372 bool ChromeContentBrowserClient::ShouldRedirectDOMStorageTaskRunner() { | 3363 bool ChromeContentBrowserClient::ShouldRedirectDOMStorageTaskRunner() { |
| 3373 return variations::GetVariationParamValue( | 3364 return variations::GetVariationParamValue( |
| 3374 "BrowserScheduler", "RedirectDOMStorageTaskRunner") == "true"; | 3365 "BrowserScheduler", "RedirectDOMStorageTaskRunner") == "true"; |
| 3375 } | 3366 } |
| 3376 | 3367 |
| 3377 bool ChromeContentBrowserClient:: | 3368 bool ChromeContentBrowserClient:: |
| 3378 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { | 3369 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { |
| 3379 return variations::GetVariationParamValue( | 3370 return variations::GetVariationParamValue( |
| 3380 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; | 3371 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; |
| 3381 } | 3372 } |
| 3382 | |
| 3383 // static | |
| 3384 void ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting( | |
| 3385 const storage::QuotaSettings* settings) { | |
| 3386 g_default_quota_settings = settings; | |
| 3387 } | |
| OLD | NEW |