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

Unified Diff: chrome/browser/ui/prefs/prefs_tab_helper.cc

Issue 1456843002: Finch experiment: auto-detect text encoding (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments Created 5 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/prefs/prefs_tab_helper.cc
diff --git a/chrome/browser/ui/prefs/prefs_tab_helper.cc b/chrome/browser/ui/prefs/prefs_tab_helper.cc
index 1eb12687fe8659a69cb1d7deb285ff0bbe1187f0..50fc060743d9a711ef3b459e75456ad6aede8e96 100644
--- a/chrome/browser/ui/prefs/prefs_tab_helper.cc
+++ b/chrome/browser/ui/prefs/prefs_tab_helper.cc
@@ -7,7 +7,9 @@
#include <set>
#include <string>
+#include "base/command_line.h"
#include "base/memory/singleton.h"
+#include "base/metrics/field_trial.h"
#include "base/prefs/overlay_user_pref_store.h"
#include "base/prefs/pref_change_registrar.h"
#include "base/prefs/pref_service.h"
@@ -318,6 +320,14 @@ void RegisterLocalizedFontPref(user_prefs::PrefRegistrySyncable* registry,
registry->RegisterIntegerPref(path, val);
}
+bool IsAutodetectEncodingEnabledByDefault() {
+ const std::string group_name = base::FieldTrialList::FindFullName(
+ "AutodetectEncoding");
+ return base::StartsWith(group_name,
+ "Enabled",
+ base::CompareCase::INSENSITIVE_ASCII);
+}
+
} // namespace
// Watching all these settings per tab is slow when a user has a lot of tabs and
@@ -581,9 +591,11 @@ void PrefsTabHelper::RegisterProfilePrefs(
IDS_MINIMUM_FONT_SIZE);
RegisterLocalizedFontPref(registry, prefs::kWebKitMinimumLogicalFontSize,
IDS_MINIMUM_LOGICAL_FONT_SIZE);
+ bool uses_universal_detector = IsAutodetectEncodingEnabledByDefault() ||
+ l10n_util::GetStringUTF8(IDS_USES_UNIVERSAL_DETECTOR) == "true";
registry->RegisterBooleanPref(
prefs::kWebKitUsesUniversalDetector,
- l10n_util::GetStringUTF8(IDS_USES_UNIVERSAL_DETECTOR) == "true",
+ uses_universal_detector,
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
registry->RegisterStringPref(
prefs::kStaticEncodings,
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/Document.h » ('j') | tools/metrics/histograms/histograms.xml » ('J')

Powered by Google App Engine
This is Rietveld 408576698