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

Side by Side Diff: blimp/client/core/settings/settings.h

Issue 2349073002: Blimp Settings framework on the c++ side (Closed)
Patch Set: Settings doesn't own its observer anymore. SettingsFeature subclass SettingsObserver 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 unified diff | Download patch
OLDNEW
(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
32 void SetEnableBlimpMode(bool enable);
33
34 // 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.
35 void SetRecordWholeDocument(bool enable);
36
37 // Change record_whole_document_.
38 void SetShowNetworkStats(bool enable);
39
40 bool blimp_enabled() { return blimp_enabled_; }
41 bool record_whole_document() { return record_whole_document_; }
42 bool show_network_stats() { return show_network_stats_; }
43
44 private:
45 // The pref service used to store persist the settings.
46 PrefService* local_state_;
47
48 // A list of all the observers of the Blimp Settings.
49 base::ObserverList<SettingsObserver> observers_;
50
51 void InitializeFromCommandLineAndPref();
52
53 // blimp_enabled_ is init from command line/PrefService. It can be changed
54 // from UI.
55 bool blimp_enabled_;
56
57 // Used to avoid sending unnecessary messages to engine. SettingsFeature sends
58 // this to the engine.
59 bool record_whole_document_;
60
61 // show_network_stats_ can only be set from UI, and the value is not stored
62 // persistently.
63 bool show_network_stats_;
64
65 DISALLOW_COPY_AND_ASSIGN(Settings);
66 };
67
68 } // namespace client
69 } // namespace blimp
70
71 #endif // BLIMP_CLIENT_CORE_SETTINGS_SETTINGS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698