| 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> |
| 11 | 11 |
| 12 #include "base/base_switches.h" | 12 #include "base/base_switches.h" |
| 13 #include "base/bind.h" | 13 #include "base/bind.h" |
| 14 #include "base/bind_helpers.h" | 14 #include "base/bind_helpers.h" |
| 15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 16 #include "base/files/scoped_file.h" | 16 #include "base/files/scoped_file.h" |
| 17 #include "base/i18n/character_encoding.h" |
| 17 #include "base/json/json_reader.h" | 18 #include "base/json/json_reader.h" |
| 18 #include "base/lazy_instance.h" | 19 #include "base/lazy_instance.h" |
| 19 #include "base/macros.h" | 20 #include "base/macros.h" |
| 20 #include "base/memory/ptr_util.h" | 21 #include "base/memory/ptr_util.h" |
| 21 #include "base/metrics/histogram_macros.h" | 22 #include "base/metrics/histogram_macros.h" |
| 22 #include "base/path_service.h" | 23 #include "base/path_service.h" |
| 23 #include "base/strings/string_number_conversions.h" | 24 #include "base/strings/string_number_conversions.h" |
| 24 #include "base/strings/string_split.h" | 25 #include "base/strings/string_split.h" |
| 25 #include "base/strings/string_util.h" | 26 #include "base/strings/string_util.h" |
| 26 #include "base/strings/stringprintf.h" | 27 #include "base/strings/stringprintf.h" |
| 27 #include "base/strings/utf_string_conversions.h" | 28 #include "base/strings/utf_string_conversions.h" |
| 28 #include "base/threading/sequenced_worker_pool.h" | 29 #include "base/threading/sequenced_worker_pool.h" |
| 29 #include "base/threading/thread_task_runner_handle.h" | 30 #include "base/threading/thread_task_runner_handle.h" |
| 30 #include "build/build_config.h" | 31 #include "build/build_config.h" |
| 31 #include "chrome/browser/after_startup_task_utils.h" | 32 #include "chrome/browser/after_startup_task_utils.h" |
| 32 #include "chrome/browser/apps/app_url_redirector.h" | 33 #include "chrome/browser/apps/app_url_redirector.h" |
| 33 #include "chrome/browser/browser_about_handler.h" | 34 #include "chrome/browser/browser_about_handler.h" |
| 34 #include "chrome/browser/browser_process.h" | 35 #include "chrome/browser/browser_process.h" |
| 35 #include "chrome/browser/browser_shutdown.h" | 36 #include "chrome/browser/browser_shutdown.h" |
| 36 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 37 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| 37 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 38 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
| 38 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" | 39 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" |
| 39 #include "chrome/browser/browsing_data/origin_filter_builder.h" | 40 #include "chrome/browser/browsing_data/origin_filter_builder.h" |
| 40 #include "chrome/browser/browsing_data/registrable_domain_filter_builder.h" | 41 #include "chrome/browser/browsing_data/registrable_domain_filter_builder.h" |
| 41 #include "chrome/browser/budget_service/budget_service_impl.h" | 42 #include "chrome/browser/budget_service/budget_service_impl.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/engagement/site_engagement_eviction_policy.h" |
| 52 #include "chrome/browser/field_trial_recorder.h" | 52 #include "chrome/browser/field_trial_recorder.h" |
| (...skipping 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1397 ShouldSwapProcessesForRedirect(browser_context, current_url, new_url); | 1397 ShouldSwapProcessesForRedirect(browser_context, current_url, new_url); |
| 1398 #else | 1398 #else |
| 1399 return false; | 1399 return false; |
| 1400 #endif | 1400 #endif |
| 1401 } | 1401 } |
| 1402 | 1402 |
| 1403 bool ChromeContentBrowserClient::ShouldAssignSiteForURL(const GURL& url) { | 1403 bool ChromeContentBrowserClient::ShouldAssignSiteForURL(const GURL& url) { |
| 1404 return !url.SchemeIs(chrome::kChromeNativeScheme); | 1404 return !url.SchemeIs(chrome::kChromeNativeScheme); |
| 1405 } | 1405 } |
| 1406 | 1406 |
| 1407 std::string ChromeContentBrowserClient::GetCanonicalEncodingNameByAliasName( | |
| 1408 const std::string& alias_name) { | |
| 1409 return ::GetCanonicalEncodingNameByAliasName(alias_name); | |
| 1410 } | |
| 1411 | |
| 1412 namespace { | 1407 namespace { |
| 1413 | 1408 |
| 1414 bool IsAutoReloadEnabled() { | 1409 bool IsAutoReloadEnabled() { |
| 1415 // Fetch the field trial, even though we don't use it. Calling FindFullName() | 1410 // Fetch the field trial, even though we don't use it. Calling FindFullName() |
| 1416 // causes the field-trial mechanism to report which group we're in, which | 1411 // causes the field-trial mechanism to report which group we're in, which |
| 1417 // might reflect a hard disable or hard enable via flag, both of which have | 1412 // might reflect a hard disable or hard enable via flag, both of which have |
| 1418 // their own field trial groups. This lets us know what percentage of users | 1413 // their own field trial groups. This lets us know what percentage of users |
| 1419 // manually enable or disable auto-reload. | 1414 // manually enable or disable auto-reload. |
| 1420 std::string group = base::FieldTrialList::FindFullName( | 1415 std::string group = base::FieldTrialList::FindFullName( |
| 1421 "AutoReloadExperiment"); | 1416 "AutoReloadExperiment"); |
| (...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2532 if (image_animation_policy == kAnimationPolicyOnce) | 2527 if (image_animation_policy == kAnimationPolicyOnce) |
| 2533 web_prefs->animation_policy = | 2528 web_prefs->animation_policy = |
| 2534 content::IMAGE_ANIMATION_POLICY_ANIMATION_ONCE; | 2529 content::IMAGE_ANIMATION_POLICY_ANIMATION_ONCE; |
| 2535 else if (image_animation_policy == kAnimationPolicyNone) | 2530 else if (image_animation_policy == kAnimationPolicyNone) |
| 2536 web_prefs->animation_policy = content::IMAGE_ANIMATION_POLICY_NO_ANIMATION; | 2531 web_prefs->animation_policy = content::IMAGE_ANIMATION_POLICY_NO_ANIMATION; |
| 2537 else | 2532 else |
| 2538 web_prefs->animation_policy = content::IMAGE_ANIMATION_POLICY_ALLOWED; | 2533 web_prefs->animation_policy = content::IMAGE_ANIMATION_POLICY_ALLOWED; |
| 2539 #endif | 2534 #endif |
| 2540 | 2535 |
| 2541 // Make sure we will set the default_encoding with canonical encoding name. | 2536 // Make sure we will set the default_encoding with canonical encoding name. |
| 2542 web_prefs->default_encoding = GetCanonicalEncodingNameByAliasName( | 2537 web_prefs->default_encoding = |
| 2543 web_prefs->default_encoding); | 2538 base::GetCanonicalEncodingNameByAliasName(web_prefs->default_encoding); |
| 2544 if (web_prefs->default_encoding.empty()) { | 2539 if (web_prefs->default_encoding.empty()) { |
| 2545 prefs->ClearPref(prefs::kDefaultCharset); | 2540 prefs->ClearPref(prefs::kDefaultCharset); |
| 2546 web_prefs->default_encoding = prefs->GetString(prefs::kDefaultCharset); | 2541 web_prefs->default_encoding = prefs->GetString(prefs::kDefaultCharset); |
| 2547 } | 2542 } |
| 2548 DCHECK(!web_prefs->default_encoding.empty()); | 2543 DCHECK(!web_prefs->default_encoding.empty()); |
| 2549 | 2544 |
| 2550 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 2545 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 2551 switches::kEnablePotentiallyAnnoyingSecurityFeatures)) { | 2546 switches::kEnablePotentiallyAnnoyingSecurityFeatures)) { |
| 2552 web_prefs->disable_reading_from_canvas = true; | 2547 web_prefs->disable_reading_from_canvas = true; |
| 2553 web_prefs->strict_mixed_content_checking = true; | 2548 web_prefs->strict_mixed_content_checking = true; |
| (...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3341 GetBrowserSchedulerWorkerPoolParamsFromVariations(); | 3336 GetBrowserSchedulerWorkerPoolParamsFromVariations(); |
| 3342 *index_to_traits_callback = base::Bind(&task_scheduler_util::initialization:: | 3337 *index_to_traits_callback = base::Bind(&task_scheduler_util::initialization:: |
| 3343 BrowserWorkerPoolIndexForTraits); | 3338 BrowserWorkerPoolIndexForTraits); |
| 3344 } | 3339 } |
| 3345 | 3340 |
| 3346 void ChromeContentBrowserClient:: | 3341 void ChromeContentBrowserClient:: |
| 3347 PerformExperimentalTaskSchedulerRedirections() { | 3342 PerformExperimentalTaskSchedulerRedirections() { |
| 3348 task_scheduler_util::variations:: | 3343 task_scheduler_util::variations:: |
| 3349 MaybePerformBrowserTaskSchedulerRedirection(); | 3344 MaybePerformBrowserTaskSchedulerRedirection(); |
| 3350 } | 3345 } |
| OLD | NEW |