| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "blimp/client/core/settings/settings.h" | 5 #include "blimp/client/core/settings/settings.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "blimp/client/core/settings/settings_observer.h" | 9 #include "blimp/client/core/settings/settings_observer.h" |
| 10 #include "blimp/client/core/settings/settings_prefs.h" | 10 #include "blimp/client/core/settings/settings_prefs.h" |
| 11 #include "blimp/client/core/switches/blimp_client_switches.h" | 11 #include "blimp/client/core/switches/blimp_client_switches.h" |
| 12 #include "components/prefs/pref_registry_simple.h" | 12 #include "components/prefs/pref_registry_simple.h" |
| 13 | 13 |
| 14 namespace blimp { | 14 namespace blimp { |
| 15 namespace client { | 15 namespace client { |
| 16 namespace { |
| 16 | 17 |
| 17 const CommandLinePrefStore::BooleanSwitchToPreferenceMapEntry | 18 const CommandLinePrefStore::BooleanSwitchToPreferenceMapEntry |
| 18 boolean_switch_map[] = { | 19 boolean_switch_map[] = { |
| 19 {blimp::switches::kEnableBlimp, prefs::kBlimpEnabled, true}, | 20 {blimp::switches::kEnableBlimp, prefs::kBlimpEnabled, true}, |
| 20 {blimp::switches::kDownloadWholeDocument, prefs::kRecordWholeDocument, | 21 {blimp::switches::kDownloadWholeDocument, prefs::kRecordWholeDocument, |
| 21 true}, | 22 true}, |
| 22 }; | 23 }; |
| 23 | 24 |
| 25 } // namespace |
| 26 |
| 24 Settings::Settings(PrefService* local_state) | 27 Settings::Settings(PrefService* local_state) |
| 25 : local_state_(local_state), show_network_stats_(false) { | 28 : local_state_(local_state), show_network_stats_(false) { |
| 26 pref_change_registrar_.Init(local_state); | 29 pref_change_registrar_.Init(local_state); |
| 27 pref_change_registrar_.Add( | 30 pref_change_registrar_.Add( |
| 28 prefs::kBlimpEnabled, | 31 prefs::kBlimpEnabled, |
| 29 base::Bind(&Settings::OnPreferenceChanged, base::Unretained(this), | 32 base::Bind(&Settings::OnPreferenceChanged, base::Unretained(this), |
| 30 local_state, prefs::kBlimpEnabled)); | 33 local_state, prefs::kBlimpEnabled)); |
| 31 pref_change_registrar_.Add( | 34 pref_change_registrar_.Add( |
| 32 prefs::kRecordWholeDocument, | 35 prefs::kRecordWholeDocument, |
| 33 base::Bind(&Settings::OnPreferenceChanged, base::Unretained(this), | 36 base::Bind(&Settings::OnPreferenceChanged, base::Unretained(this), |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 } | 92 } |
| 90 | 93 |
| 91 // static | 94 // static |
| 92 void Settings::ApplyBlimpSwitches(CommandLinePrefStore* store) { | 95 void Settings::ApplyBlimpSwitches(CommandLinePrefStore* store) { |
| 93 store->ApplyBooleanSwitches(boolean_switch_map, | 96 store->ApplyBooleanSwitches(boolean_switch_map, |
| 94 arraysize(boolean_switch_map)); | 97 arraysize(boolean_switch_map)); |
| 95 } | 98 } |
| 96 | 99 |
| 97 } // namespace client | 100 } // namespace client |
| 98 } // namespace blimp | 101 } // namespace blimp |
| OLD | NEW |