| 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 #include "components/prefs/command_line_pref_store.h" |
| 11 #include "components/prefs/pref_change_registrar.h" |
| 12 #include "components/prefs/pref_observer.h" |
| 13 #include "components/prefs/pref_service.h" |
| 14 |
| 15 class CommandLinePrefStore; |
| 16 class PrefRegistrySimple; |
| 17 |
| 18 namespace blimp { |
| 19 namespace client { |
| 20 |
| 21 class SettingsObserver; |
| 22 |
| 23 class Settings : public PrefObserver { |
| 24 public: |
| 25 explicit Settings(PrefService* local_state); |
| 26 virtual ~Settings(); |
| 27 |
| 28 static void RegisterPrefs(PrefRegistrySimple* registry); |
| 29 static void ApplyBlimpSwitches(CommandLinePrefStore* store); |
| 30 |
| 31 void AddObserver(SettingsObserver* observer); |
| 32 void RemoveObserver(SettingsObserver* observer); |
| 33 |
| 34 // Set whether or not Blimp mode is enabled. |
| 35 void SetEnableBlimpMode(bool enable); |
| 36 |
| 37 // Set record_whole_document_, and save it to the persistent storage. |
| 38 void SetRecordWholeDocument(bool enable); |
| 39 |
| 40 // Set show_network_stats_. |
| 41 void SetShowNetworkStats(bool enable); |
| 42 |
| 43 // PrefObserver implementation. |
| 44 void OnPreferenceChanged(PrefService* service, |
| 45 const std::string& pref_name) override; |
| 46 |
| 47 // Whether or not Blimp mode is enabled. |
| 48 // Can be changed via: command line --enable-blimp, setting dialog. |
| 49 // Persisted across restarts: Yes. |
| 50 bool IsBlimpEnabled(); |
| 51 |
| 52 // Whether or not the engine sends the whole webpage at once or pieces of it |
| 53 // based on the current viewport. |
| 54 // Can be changed via: command line --download-whole-document, setting dialog. |
| 55 // Persisted across restarts: Yes. |
| 56 bool IsRecordWholeDocument(); |
| 57 |
| 58 // Whether or not to show the network stats. |
| 59 // Can be changed via: setting dialog. |
| 60 // Persisted across restarts: No. |
| 61 bool show_network_stats() { return show_network_stats_; } |
| 62 |
| 63 private: |
| 64 // The pref service used to store the persistent settings. |
| 65 PrefService* local_state_; |
| 66 |
| 67 PrefChangeRegistrar pref_change_registrar_; |
| 68 |
| 69 // A list of all the observers of the Blimp Settings. |
| 70 base::ObserverList<SettingsObserver> observers_; |
| 71 |
| 72 bool show_network_stats_; |
| 73 |
| 74 DISALLOW_COPY_AND_ASSIGN(Settings); |
| 75 }; |
| 76 |
| 77 } // namespace client |
| 78 } // namespace blimp |
| 79 |
| 80 #endif // BLIMP_CLIENT_CORE_SETTINGS_SETTINGS_H_ |
| OLD | NEW |