| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef BLIMP_CLIENT_CORE_SETTINGS_SETTINGS_H_ |
| 6 #define BLIMP_CLIENT_CORE_SETTINGS_SETTINGS_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/observer_list.h" |
| 10 |
| 11 class PrefRegistrySimple; |
| 12 class PrefService; |
| 13 |
| 14 namespace blimp { |
| 15 namespace client { |
| 16 |
| 17 class SettingsObserver; |
| 18 |
| 19 class Settings { |
| 20 public: |
| 21 explicit Settings(PrefService* local_state); |
| 22 virtual ~Settings(); |
| 23 |
| 24 static void RegisterPrefs(PrefRegistrySimple* registry); |
| 25 |
| 26 void AddObserver(SettingsObserver* observer); |
| 27 void RemoveObserver(SettingsObserver* observer); |
| 28 |
| 29 // Change blimp_enabled_, and save it to the persistent storage. |
| 30 // blimp_enabled_ can also be enabled by adding command line flag |
| 31 // --enable-blimp |
| 32 void SetEnableBlimpMode(bool enable); |
| 33 |
| 34 // Change record_whole_document_. record_whole_document_ can also be enabled |
| 35 // by adding command line flag --record-whole-document. |
| 36 void SetRecordWholeDocument(bool enable); |
| 37 |
| 38 // Change show_network_stats_, and save it to the persistent storage. |
| 39 void SetShowNetworkStats(bool enable); |
| 40 |
| 41 bool blimp_enabled() { return blimp_enabled_; } |
| 42 bool record_whole_document() { return record_whole_document_; } |
| 43 bool show_network_stats() { return show_network_stats_; } |
| 44 |
| 45 private: |
| 46 // The pref service used to store persist the settings. |
| 47 PrefService* local_state_; |
| 48 |
| 49 // A list of all the observers of the Blimp Settings. |
| 50 base::ObserverList<SettingsObserver> observers_; |
| 51 |
| 52 void InitializeFromCommandLineAndPref(); |
| 53 |
| 54 // blimp_enabled_ is init from command line/PrefService. It can be changed |
| 55 // from UI. |
| 56 bool blimp_enabled_; |
| 57 |
| 58 // Used to avoid sending unnecessary messages to engine. SettingsFeature sends |
| 59 // this to the engine. |
| 60 bool record_whole_document_; |
| 61 |
| 62 // show_network_stats_ can only be set from UI, and the value is not stored |
| 63 // persistently. |
| 64 bool show_network_stats_; |
| 65 |
| 66 DISALLOW_COPY_AND_ASSIGN(Settings); |
| 67 }; |
| 68 |
| 69 } // namespace client |
| 70 } // namespace blimp |
| 71 |
| 72 #endif // BLIMP_CLIENT_CORE_SETTINGS_SETTINGS_H_ |
| OLD | NEW |