Chromium Code Reviews| 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 |
| + |