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

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: merged with the cl using the new methods 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/Document.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..3dd5baa718119099d86ae7df2c20c4ca1a58b01b 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 IsAutodetectEncodingEnabled() {
battre 2015/12/02 13:08:26 nit: Should this be IsAutodetectEncodingEnabledByD
Jinsuk Kim 2015/12/02 23:14:38 Done.
+ 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 = IsAutodetectEncodingEnabled() ?
+ true : l10n_util::GetStringUTF8(IDS_USES_UNIVERSAL_DETECTOR) == "true";
battre 2015/12/02 13:08:26 ... = IsAutodetectEncodingEnabled() || l10n_util::
Jinsuk Kim 2015/12/02 23:14:38 Done.
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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698