Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Side by Side Diff: chrome/browser/chrome_content_browser_client.cc

Issue 2578003002: Move |GetCanonicalEncodingNameByAliasName| to base/i18n (Closed)
Patch Set: rebased Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/chrome_content_browser_client.h ('k') | chrome/test/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_quota_permission_context.h" 44 #include "chrome/browser/chrome_quota_permission_context.h"
45 #include "chrome/browser/content_settings/cookie_settings_factory.h" 45 #include "chrome/browser/content_settings/cookie_settings_factory.h"
46 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 46 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
47 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 47 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
48 #include "chrome/browser/defaults.h" 48 #include "chrome/browser/defaults.h"
49 #include "chrome/browser/download/download_prefs.h" 49 #include "chrome/browser/download/download_prefs.h"
50 #include "chrome/browser/engagement/site_engagement_eviction_policy.h" 50 #include "chrome/browser/engagement/site_engagement_eviction_policy.h"
51 #include "chrome/browser/field_trial_recorder.h" 51 #include "chrome/browser/field_trial_recorder.h"
52 #include "chrome/browser/font_family_cache.h" 52 #include "chrome/browser/font_family_cache.h"
(...skipping 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after
1404 ShouldSwapProcessesForRedirect(browser_context, current_url, new_url); 1404 ShouldSwapProcessesForRedirect(browser_context, current_url, new_url);
1405 #else 1405 #else
1406 return false; 1406 return false;
1407 #endif 1407 #endif
1408 } 1408 }
1409 1409
1410 bool ChromeContentBrowserClient::ShouldAssignSiteForURL(const GURL& url) { 1410 bool ChromeContentBrowserClient::ShouldAssignSiteForURL(const GURL& url) {
1411 return !url.SchemeIs(chrome::kChromeNativeScheme); 1411 return !url.SchemeIs(chrome::kChromeNativeScheme);
1412 } 1412 }
1413 1413
1414 std::string ChromeContentBrowserClient::GetCanonicalEncodingNameByAliasName(
1415 const std::string& alias_name) {
1416 return ::GetCanonicalEncodingNameByAliasName(alias_name);
1417 }
1418
1419 namespace { 1414 namespace {
1420 1415
1421 bool IsAutoReloadEnabled() { 1416 bool IsAutoReloadEnabled() {
1422 // Fetch the field trial, even though we don't use it. Calling FindFullName() 1417 // Fetch the field trial, even though we don't use it. Calling FindFullName()
1423 // causes the field-trial mechanism to report which group we're in, which 1418 // causes the field-trial mechanism to report which group we're in, which
1424 // might reflect a hard disable or hard enable via flag, both of which have 1419 // might reflect a hard disable or hard enable via flag, both of which have
1425 // their own field trial groups. This lets us know what percentage of users 1420 // their own field trial groups. This lets us know what percentage of users
1426 // manually enable or disable auto-reload. 1421 // manually enable or disable auto-reload.
1427 std::string group = base::FieldTrialList::FindFullName( 1422 std::string group = base::FieldTrialList::FindFullName(
1428 "AutoReloadExperiment"); 1423 "AutoReloadExperiment");
(...skipping 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after
2523 if (image_animation_policy == kAnimationPolicyOnce) 2518 if (image_animation_policy == kAnimationPolicyOnce)
2524 web_prefs->animation_policy = 2519 web_prefs->animation_policy =
2525 content::IMAGE_ANIMATION_POLICY_ANIMATION_ONCE; 2520 content::IMAGE_ANIMATION_POLICY_ANIMATION_ONCE;
2526 else if (image_animation_policy == kAnimationPolicyNone) 2521 else if (image_animation_policy == kAnimationPolicyNone)
2527 web_prefs->animation_policy = content::IMAGE_ANIMATION_POLICY_NO_ANIMATION; 2522 web_prefs->animation_policy = content::IMAGE_ANIMATION_POLICY_NO_ANIMATION;
2528 else 2523 else
2529 web_prefs->animation_policy = content::IMAGE_ANIMATION_POLICY_ALLOWED; 2524 web_prefs->animation_policy = content::IMAGE_ANIMATION_POLICY_ALLOWED;
2530 #endif 2525 #endif
2531 2526
2532 // Make sure we will set the default_encoding with canonical encoding name. 2527 // Make sure we will set the default_encoding with canonical encoding name.
2533 web_prefs->default_encoding = GetCanonicalEncodingNameByAliasName( 2528 web_prefs->default_encoding =
2534 web_prefs->default_encoding); 2529 base::GetCanonicalEncodingNameByAliasName(web_prefs->default_encoding);
2535 if (web_prefs->default_encoding.empty()) { 2530 if (web_prefs->default_encoding.empty()) {
2536 prefs->ClearPref(prefs::kDefaultCharset); 2531 prefs->ClearPref(prefs::kDefaultCharset);
2537 web_prefs->default_encoding = prefs->GetString(prefs::kDefaultCharset); 2532 web_prefs->default_encoding = prefs->GetString(prefs::kDefaultCharset);
2538 } 2533 }
2539 DCHECK(!web_prefs->default_encoding.empty()); 2534 DCHECK(!web_prefs->default_encoding.empty());
2540 2535
2541 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 2536 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
2542 switches::kEnablePotentiallyAnnoyingSecurityFeatures)) { 2537 switches::kEnablePotentiallyAnnoyingSecurityFeatures)) {
2543 web_prefs->disable_reading_from_canvas = true; 2538 web_prefs->disable_reading_from_canvas = true;
2544 web_prefs->strict_mixed_content_checking = true; 2539 web_prefs->strict_mixed_content_checking = true;
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after
3375 bool ChromeContentBrowserClient::ShouldRedirectDOMStorageTaskRunner() { 3370 bool ChromeContentBrowserClient::ShouldRedirectDOMStorageTaskRunner() {
3376 return variations::GetVariationParamValue( 3371 return variations::GetVariationParamValue(
3377 "BrowserScheduler", "RedirectDOMStorageTaskRunner") == "true"; 3372 "BrowserScheduler", "RedirectDOMStorageTaskRunner") == "true";
3378 } 3373 }
3379 3374
3380 bool ChromeContentBrowserClient:: 3375 bool ChromeContentBrowserClient::
3381 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { 3376 RedirectNonUINonIOBrowserThreadsToTaskScheduler() {
3382 return variations::GetVariationParamValue( 3377 return variations::GetVariationParamValue(
3383 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; 3378 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true";
3384 } 3379 }
OLDNEW
« no previous file with comments | « chrome/browser/chrome_content_browser_client.h ('k') | chrome/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698