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

Unified Diff: components/dom_distiller/core/reader_mode_preferences.cc

Issue 341563002: Theme Preferences for Distilled Pages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Switched to Profile from PrefService Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: components/dom_distiller/core/reader_mode_preferences.cc
diff --git a/components/dom_distiller/core/reader_mode_preferences.cc b/components/dom_distiller/core/reader_mode_preferences.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b3f22258438c9fccecfecccb04692123774a9875
--- /dev/null
+++ b/components/dom_distiller/core/reader_mode_preferences.cc
@@ -0,0 +1,43 @@
+// Copyright 2014 The Chromium Authros. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/dom_distiller/core/reader_mode_preferences.h"
+
+#include <string>
+#include <vector>
+
+#include "base/prefs/pref_service.h"
+#include "base/strings/string_util.h"
+#include "chrome/browser/profiles/profile.h"
+#include "components/dom_distiller/core/url_constants.h"
+#include "components/pref_registry/pref_registry_syncable.h"
+#include "grit/component_resources.h"
+#include "ui/base/resource/resource_bundle.h"
+
+namespace prefs {
+ const char kHigh_Contrast_Pref[] = "reader_mode.high_contrast";
robliao 2014/06/17 23:08:15 Remove one level of indentation.
smaslo 2014/06/18 16:57:15 Done.
+}
+
+namespace dom_distiller {
+
+ReaderModePrefs::ReaderModePrefs(Profile* profile)
+ :profile_(profile) {
robliao 2014/06/17 23:08:15 Add Space between : and profile_(...
smaslo 2014/06/18 16:57:15 Done.
+}
+
+void ReaderModePrefs::RegisterProfilePrefs(
+ user_prefs::PrefRegistrySyncable* registry) {
+ registry->RegisterBooleanPref(prefs::kHigh_Contrast_Pref,
+ false,
+ user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
+}
+
+void ReaderModePrefs::OnChangeHighContrast(bool new_value) {
+ profile_->GetPrefs()->SetBoolean(prefs::kHigh_Contrast_Pref, new_value);
+}
robliao 2014/06/17 23:08:15 Add linebreak here.
smaslo 2014/06/18 16:57:15 Done.
+bool ReaderModePrefs::GetHighContrastPref() {
+ return profile_->GetPrefs()->GetBoolean(prefs::kHigh_Contrast_Pref);
+}
+
+} // namespace dom_distiller
+

Powered by Google App Engine
This is Rietveld 408576698