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

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: Minor change to constant name 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..c42f535c353837bb528738c42f721eb7431ae4b3
--- /dev/null
+++ b/components/dom_distiller/core/reader_mode_preferences.cc
@@ -0,0 +1,41 @@
+// 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/dom_distiller_pref_names.h"
+#include "components/dom_distiller/core/url_constants.h"
nyquist 2014/06/23 16:03:06 Are all these includes in use?
smaslo 2014/06/23 22:14:33 Done.
+#include "components/pref_registry/pref_registry_syncable.h"
+#include "grit/component_resources.h"
+#include "ui/base/resource/resource_bundle.h"
+
+namespace dom_distiller {
+
+ReaderModePrefs::ReaderModePrefs(Profile* profile)
+ : profile_(profile) {
+}
+
+void ReaderModePrefs::RegisterProfilePrefs(
+ user_prefs::PrefRegistrySyncable* registry) {
+ registry->RegisterBooleanPref(prefs::kHighContrastPref,
+ false,
+ user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
+}
+
+void ReaderModePrefs::OnChangeHighContrast(bool new_value) {
battre 2014/06/23 08:37:23 WDYT of renaming this to SetHighContrastPref(bool
nyquist 2014/06/23 16:03:06 Like battre suggests, having consistent naming acr
smaslo 2014/06/23 22:14:33 Done.
smaslo 2014/06/23 22:14:33 Done.
+ profile_->GetPrefs()->SetBoolean(prefs::kHighContrastPref, new_value);
nyquist 2014/06/23 16:03:06 This code and below will become simpler when you j
smaslo 2014/06/23 22:14:33 Done.
+}
+
+bool ReaderModePrefs::GetHighContrastPref() {
+ return profile_->GetPrefs()->GetBoolean(prefs::kHighContrastPref);
+}
+
+} // namespace dom_distiller
+

Powered by Google App Engine
This is Rietveld 408576698