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

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: Changes from comments on patch 9 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..82b62236d8588eee660ab2221841806f8085a4a2
--- /dev/null
+++ b/components/dom_distiller/core/reader_mode_preferences.cc
@@ -0,0 +1,40 @@
+// Copyright 2014 The Chromium Authors. 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 "base/prefs/pref_service.h"
+#include "components/pref_registry/pref_registry_syncable.h"
+
+namespace {
+
+// True if user prefers high-contrast (dark) appearance when in reader mode.
nyquist 2014/06/24 23:08:49 s/True if user prefers/Whether user prefers/
smaslo 2014/06/26 20:05:38 Changed entirely
+const char kHighContrastPref[] = "reader_mode.high_contrast";
nyquist 2014/06/24 23:08:49 I wonder if we should prefix this preference with
smaslo 2014/06/26 20:05:38 Done.
+
+}
+
+namespace dom_distiller {
+
+ReaderModePrefs::ReaderModePrefs(PrefService* pref_service)
+ : pref_service_(pref_service) {
+}
+
+// static
+void ReaderModePrefs::RegisterProfilePrefs(
+ user_prefs::PrefRegistrySyncable* registry) {
+ registry->RegisterBooleanPref(kHighContrastPref,
+ false,
+ user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
+}
+
+void ReaderModePrefs::SetHighContrastPref(bool new_value) {
+ pref_service_->SetBoolean(kHighContrastPref, new_value);
+}
+
+bool ReaderModePrefs::GetHighContrastPref() const {
+ return pref_service_->GetBoolean(kHighContrastPref);
+}
+
+} // namespace dom_distiller
+

Powered by Google App Engine
This is Rietveld 408576698