Chromium Code Reviews| 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 // Set blimp_enabled_, and save it to the persistent storage. | |
| 30 void SetEnableBlimpMode(bool enable); | |
| 31 | |
| 32 // Set record_whole_document_, and save it to the persistent storage. | |
| 33 void SetRecordWholeDocument(bool enable); | |
| 34 | |
| 35 // Set show_network_stats_. | |
| 36 void SetShowNetworkStats(bool enable); | |
| 37 | |
| 38 bool blimp_enabled() { return blimp_enabled_; } | |
| 39 bool record_whole_document() { return record_whole_document_; } | |
| 40 bool show_network_stats() { return show_network_stats_; } | |
| 41 | |
| 42 private: | |
| 43 // The pref service used to store the persistent settings. | |
| 44 PrefService* local_state_; | |
| 45 | |
| 46 // A list of all the observers of the Blimp Settings. | |
| 47 base::ObserverList<SettingsObserver> observers_; | |
| 48 | |
| 49 // Called in Settings' constructor. | |
| 50 // Pulls initial settings values from command line or persistent storage. | |
| 51 void InitializeFromCommandLineAndPref(); | |
|
Menglin
2016/10/24 22:44:58
I dont think we need this anymore. because switche
| |
| 52 | |
| 53 // Whether or not Blimp mode is enabled. | |
| 54 // Can be changed via: command line --enable-blimp, setting dialog. | |
| 55 // Persisted across restarts: Yes. | |
| 56 bool blimp_enabled_; | |
| 57 | |
| 58 // Whether or not the engine sends the whole webpage at once or pieces of it | |
| 59 // based on the current viewport. | |
| 60 // Can be changed via: command line --download-whole-document, setting dialog. | |
| 61 // Persisted across restarts: Yes. | |
| 62 bool record_whole_document_; | |
| 63 | |
| 64 // Whether or not to show the network stats. | |
| 65 // Can be changed via: setting dialog. | |
| 66 // Persisted across restarts: No. | |
| 67 bool show_network_stats_; | |
| 68 | |
| 69 DISALLOW_COPY_AND_ASSIGN(Settings); | |
| 70 }; | |
| 71 | |
| 72 } // namespace client | |
| 73 } // namespace blimp | |
| 74 | |
| 75 #endif // BLIMP_CLIENT_CORE_SETTINGS_SETTINGS_H_ | |
| OLD | NEW |