| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // use of this source code is governed by a BSD-style license that can be | 2 // use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/dom_distiller/core/reader_mode_preferences.h" | 5 #include "components/dom_distiller/core/reader_mode_preferences.h" |
| 6 | 6 |
| 7 #include <string> | |
| 8 #include <vector> | |
| 9 | |
| 10 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 11 #include "base/strings/string_util.h" | |
| 12 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 13 #include "components/dom_distiller/core/dom_distiller_pref_names.h" | 9 #include "components/dom_distiller/core/dom_distiller_pref_names.h" |
| 14 #include "components/dom_distiller/core/url_constants.h" | 10 #include "components/dom_distiller/core/url_constants.h" |
| 15 #include "components/pref_registry/pref_registry_syncable.h" | 11 #include "components/pref_registry/pref_registry_syncable.h" |
| 16 #include "grit/component_resources.h" | 12 #include "grit/component_resources.h" |
| 17 #include "ui/base/resource/resource_bundle.h" | 13 #include "ui/base/resource/resource_bundle.h" |
| 18 | 14 |
| 19 namespace dom_distiller { | 15 namespace dom_distiller { |
| 20 | 16 |
| 21 ReaderModePrefs::ReaderModePrefs(Profile* profile) | 17 ReaderModePrefs::ReaderModePrefs(Profile* profile) |
| 22 : profile_(profile) { | 18 : profile_(profile) { |
| 23 } | 19 } |
| 24 | 20 |
| 25 void ReaderModePrefs::RegisterProfilePrefs( | 21 void ReaderModePrefs::RegisterProfilePrefs( |
| 26 user_prefs::PrefRegistrySyncable* registry) { | 22 user_prefs::PrefRegistrySyncable* registry) { |
| 27 registry->RegisterBooleanPref(prefs::kHighContrastPref, | 23 registry->RegisterBooleanPref(prefs::kHighContrastPref, |
| 28 false, | 24 false, |
| 29 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 25 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
| 30 } | 26 } |
| 31 | 27 |
| 32 void ReaderModePrefs::OnChangeHighContrast(bool new_value) { | 28 void ReaderModePrefs::OnChangeHighContrast(bool new_value) { |
| 33 profile_->GetPrefs()->SetBoolean(prefs::kHighContrastPref, new_value); | 29 profile_->GetPrefs()->SetBoolean(prefs::kHighContrastPref, new_value); |
| 34 } | 30 } |
| 35 | 31 |
| 36 bool ReaderModePrefs::GetHighContrastPref() { | 32 bool ReaderModePrefs::GetHighContrastPref() { |
| 37 return profile_->GetPrefs()->GetBoolean(prefs::kHighContrastPref); | 33 return profile_->GetPrefs()->GetBoolean(prefs::kHighContrastPref); |
| 38 } | 34 } |
| 39 | 35 |
| 40 } // namespace dom_distiller | 36 } // namespace dom_distiller |
| 41 | |
| OLD | NEW |