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..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 |
| + |