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 // 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 | |
|
David Trainor- moved to gerrit
2016/10/05 23:46:20
. after
Menglin
2016/10/06 22:36:38
Done.
| |
| 32 void SetEnableBlimpMode(bool enable); | |
|
David Trainor- moved to gerrit
2016/10/05 23:46:20
Add some comments about what each of these setting
Menglin
2016/10/06 22:36:38
I added the comments at each private members.
| |
| 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. | |
|
David Trainor- moved to gerrit
2016/10/05 23:46:21
Does (Should?) this actually save to persistent st
Menglin
2016/10/06 22:36:38
No it shouldn't..
| |
| 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(); | |
|
David Trainor- moved to gerrit
2016/10/05 23:46:21
Describe what this does/how it's used.
Menglin
2016/10/06 22:36:38
Done.
| |
| 53 | |
| 54 // blimp_enabled_ is init from command line/PrefService. It can be changed | |
|
David Trainor- moved to gerrit
2016/10/05 23:46:20
s/init/initialized/
Menglin
2016/10/06 22:36:38
The comments are updated in the new format
| |
| 55 // from UI. | |
|
David Trainor- moved to gerrit
2016/10/05 23:46:21
s/from UI/from the UI/
Menglin
2016/10/06 22:36:38
Done.
| |
| 56 bool blimp_enabled_; | |
| 57 | |
| 58 // Used to avoid sending unnecessary messages to engine. SettingsFeature sends | |
|
David Trainor- moved to gerrit
2016/10/05 23:46:20
This determines whether or not the engine sends th
Menglin
2016/10/06 22:36:38
Done.
| |
| 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 | |
|
David Trainor- moved to gerrit
2016/10/05 23:46:20
Maybe for all of these (or the function calls to s
Menglin
2016/10/06 22:36:38
Thanks, this is a much better way. Otherwise even
| |
| 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 |