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..4f691de81b58b4546389177edde2de3a04ac04a3 |
| --- /dev/null |
| +++ b/blimp/client/core/settings/settings.h |
| @@ -0,0 +1,71 @@ |
| +// 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); |
| + |
| + // Change blimp_enabled_, and save it to the persistent storage. |
| + // blimp_enabled_ can also be enabled by adding command line flag |
| + // --enable-blimp |
| + void SetEnableBlimpMode(bool enable); |
| + |
| + // Change show_network_stats_, and save it to the persistent storage. |
|
David Trainor- moved to gerrit
2016/10/01 03:26:34
Flip this comment and the one below it? Also ment
Menglin
2016/10/03 23:08:27
Done.
|
| + void SetRecordWholeDocument(bool enable); |
| + |
| + // Change record_whole_document_. |
| + 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 persist the settings. |
| + PrefService* local_state_; |
| + |
| + // A list of all the observers of the Blimp Settings. |
| + base::ObserverList<SettingsObserver> observers_; |
| + |
| + void InitializeFromCommandLineAndPref(); |
| + |
| + // blimp_enabled_ is init from command line/PrefService. It can be changed |
| + // from UI. |
| + bool blimp_enabled_; |
| + |
| + // Used to avoid sending unnecessary messages to engine. SettingsFeature sends |
| + // this to the engine. |
| + bool record_whole_document_; |
| + |
| + // show_network_stats_ can only be set from UI, and the value is not stored |
| + // persistently. |
| + bool show_network_stats_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(Settings); |
| +}; |
| + |
| +} // namespace client |
| +} // namespace blimp |
| + |
| +#endif // BLIMP_CLIENT_CORE_SETTINGS_SETTINGS_H_ |