Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6272)

Unified Diff: blimp/client/core/settings/settings.h

Issue 2349073002: Blimp Settings framework on the c++ side (Closed)
Patch Set: nits and sync to head Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « blimp/client/core/settings/BUILD.gn ('k') | blimp/client/core/settings/settings.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..81bbf790a3618b03c0951cb4b51551e428beb008
--- /dev/null
+++ b/blimp/client/core/settings/settings.h
@@ -0,0 +1,80 @@
+// 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"
+#include "components/prefs/command_line_pref_store.h"
+#include "components/prefs/pref_change_registrar.h"
+#include "components/prefs/pref_observer.h"
+#include "components/prefs/pref_service.h"
+
+class CommandLinePrefStore;
+class PrefRegistrySimple;
+
+namespace blimp {
+namespace client {
+
+class SettingsObserver;
+
+class Settings : public PrefObserver {
+ public:
+ explicit Settings(PrefService* local_state);
+ virtual ~Settings();
+
+ static void RegisterPrefs(PrefRegistrySimple* registry);
+ static void ApplyBlimpSwitches(CommandLinePrefStore* store);
+
+ void AddObserver(SettingsObserver* observer);
+ void RemoveObserver(SettingsObserver* observer);
+
+ // Set whether or not Blimp mode is enabled.
+ 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);
+
+ // PrefObserver implementation.
+ void OnPreferenceChanged(PrefService* service,
+ const std::string& pref_name) override;
+
+ // Whether or not Blimp mode is enabled.
+ // Can be changed via: command line --enable-blimp, setting dialog.
+ // Persisted across restarts: Yes.
+ bool IsBlimpEnabled();
+
+ // 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 IsRecordWholeDocument();
+
+ // Whether or not to show the network stats.
+ // Can be changed via: setting dialog.
+ // Persisted across restarts: No.
+ bool show_network_stats() { return show_network_stats_; }
+
+ private:
+ // The pref service used to store the persistent settings.
+ PrefService* local_state_;
+
+ PrefChangeRegistrar pref_change_registrar_;
+
+ // A list of all the observers of the Blimp Settings.
+ base::ObserverList<SettingsObserver> observers_;
+
+ bool show_network_stats_;
+
+ DISALLOW_COPY_AND_ASSIGN(Settings);
+};
+
+} // namespace client
+} // namespace blimp
+
+#endif // BLIMP_CLIENT_CORE_SETTINGS_SETTINGS_H_
« no previous file with comments | « blimp/client/core/settings/BUILD.gn ('k') | blimp/client/core/settings/settings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698