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

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

Issue 2349073002: Blimp Settings framework on the c++ side (Closed)
Patch Set: Created 4 years, 3 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 SettingsFeature;
18 class SettingsObserver;
19
20 class Settings {
21 public:
22 explicit Settings(PrefService* local_state);
23 virtual ~Settings();
24
25 static void RegisterPrefs(PrefRegistrySimple* registry);
26
27 // TODO(mlliu): pull more settings from java.
28 // Initializes blimp_enabled_, and record_whole_document_ from the command
David Trainor- moved to gerrit 2016/09/27 04:10:06 Maybe don't include this. I expect it to get out
Menglin 2016/09/30 23:48:57 Done.
29 // line flags and the PrefService.
30 void InitializeFromCommandLineAndPref();
David Trainor- moved to gerrit 2016/09/27 04:10:06 Can this just happen in the constructor?
Menglin 2016/09/30 23:48:57 Yes. Then I need to test the constructor because t
31
32 void AddObserver(std::unique_ptr<SettingsObserver> observer);
David Trainor- moved to gerrit 2016/09/27 04:10:06 I think giving ownership of the observer is a bit
Menglin 2016/09/30 23:48:57 Done.
33 void RemoveObserver(std::unique_ptr<SettingsObserver> observer) {}
David Trainor- moved to gerrit 2016/09/27 04:10:06 Implement?
Menglin 2016/09/30 23:48:57 Done.
34
35 void SetEnableBlimpMode(bool enable);
David Trainor- moved to gerrit 2016/09/27 04:10:06 Comment on these? Maybe also include what command
Menglin 2016/09/30 23:48:57 Done.
36 void SetRecordWholeDocument(bool enable);
37 void SetShowNetworkStats(bool enable);
38
39 bool blimp_enabled() { return blimp_enabled_; }
40 bool record_whole_document() { return record_whole_document_; }
41 bool show_network_stats() { return show_network_stats_; }
42
43 private:
44 // The pref service used to store persist the settings.
45 PrefService* local_state_;
46
47 // A list of all the observers of the Blimp Settings.
48 std::vector<std::unique_ptr<SettingsObserver>> observers_;
49
50 // blimp_enabled_ is init from command line/PrefService. It can be changed
51 // from UI.
52 bool blimp_enabled_;
53
54 // Used to avoid sending unnecessary messages to engine. SettingsFeature sends
55 // this to the engine.
56 bool record_whole_document_;
57
58 // show_network_stats_ can only be set from UI, and the value is not stored
59 // persistently.
60 bool show_network_stats_;
61
62 DISALLOW_COPY_AND_ASSIGN(Settings);
63 };
64
65 } // namespace client
66 } // namespace blimp
67
68 #endif // BLIMP_CLIENT_CORE_SETTINGS_SETTINGS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698