Chromium Code Reviews| Index: blimp/client/core/settings/settings.h |
| diff --git a/blimp/client/core/settings/settings.h b/blimp/client/core/settings/settings.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..10eef77c564d5a1f46bf58f54434c62f22e6a39d |
| --- /dev/null |
| +++ b/blimp/client/core/settings/settings.h |
| @@ -0,0 +1,76 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef BLIMP_CLIENT_CORE_SETTINGS_SETTINGS_H_ |
| +#define BLIMP_CLIENT_CORE_SETTINGS_SETTINGS_H_ |
| + |
| +#include "base/macros.h" |
| +#include "base/observer_list.h" |
| + |
| +class PrefRegistrySimple; |
| +class PrefService; |
| + |
| +namespace blimp { |
| +namespace client { |
| + |
| +class SettingsObserver; |
| + |
| +class Settings { |
| + public: |
| + explicit Settings(PrefService* local_state); |
| + virtual ~Settings(); |
| + |
| + static void RegisterPrefs(PrefRegistrySimple* registry); |
| + |
| + void AddObserver(SettingsObserver* observer); |
| + void RemoveObserver(SettingsObserver* observer); |
| + |
| + // Set blimp_enabled_, and save it to the persistent storage. |
| + void SetEnableBlimpMode(bool enable); |
| + |
| + // Set record_whole_document_, and save it to the persistent storage. |
| + void SetRecordWholeDocument(bool enable); |
| + |
| + // Set show_network_stats_. |
| + void SetShowNetworkStats(bool enable); |
| + |
| + bool blimp_enabled() { return blimp_enabled_; } |
| + bool record_whole_document() { return record_whole_document_; } |
| + bool show_network_stats() { return show_network_stats_; } |
| + |
| + private: |
| + // The pref service used to store the persistent settings. |
| + PrefService* local_state_; |
| + |
| + // A list of all the observers of the Blimp Settings. |
| + base::ObserverList<SettingsObserver> observers_; |
| + |
| + // Called in Settings' constructor. |
| + // It gets blimp_enabled_ and record_whole_document_ from command line or |
|
David Trainor- moved to gerrit
2016/10/07 07:04:59
Maybe keep this generic. It'll get dated quickly.
Menglin
2016/10/08 00:20:55
very well worded. thank you
|
| + // persistent storage. |
| + void InitializeFromCommandLineAndPref(); |
| + |
| + // Whether or not Blimp mode is enabled. |
| + // Can be changed via: command line --enable-blimp, setting dialog. |
| + // Persisted across restarts: Yes. |
| + bool blimp_enabled_; |
| + |
| + // Whether or not the engine sends the whole webpage at once or pieces of it |
| + // based on the current viewport. |
| + // Can be changed via: command line --download-whole-document, setting dialog. |
| + // Persisted across restarts: Yes. |
| + bool record_whole_document_; |
| + |
| + // Whether or not to show the network stats. |
| + // Can be changed via: setting dialog. |
| + // Persisted across restarts: No. |
| + bool show_network_stats_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(Settings); |
| +}; |
| + |
| +} // namespace client |
| +} // namespace blimp |
| + |
| +#endif // BLIMP_CLIENT_CORE_SETTINGS_SETTINGS_H_ |