| 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..96b41e4fe11f6fd474ccd16013066733d5f4cf38
|
| --- /dev/null
|
| +++ b/blimp/client/core/settings/settings.h
|
| @@ -0,0 +1,72 @@
|
| +// 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 record_whole_document_. record_whole_document_ can also be enabled
|
| + // by adding command line flag --record-whole-document.
|
| + void SetRecordWholeDocument(bool enable);
|
| +
|
| + // Change show_network_stats_, and save it to the persistent storage.
|
| + 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_
|
|
|