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

Side by Side Diff: components/prefs/command_line_pref_store.h

Issue 2419733005: Extract a base class from CommandLinePrefStore (Closed)
Patch Set: Extract a base class from CommandLinePrefStore 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
« no previous file with comments | « components/prefs/BUILD.gn ('k') | components/prefs/command_line_pref_store.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 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 COMPONENTS_PREFS_COMMAND_LINE_PREF_STORE_H_
6 #define COMPONENTS_PREFS_COMMAND_LINE_PREF_STORE_H_
7
8 #include "base/command_line.h"
9 #include "base/macros.h"
10 #include "base/values.h"
11 #include "components/prefs/value_map_pref_store.h"
12
13 // Base class for a PrefStore that maps command line switches to preferences.
14 // Subclasses should call the Apply...Switches() methods with their own maps.
Bernhard Bauer 2016/10/17 14:46:38 OK, sorry. Now this comment isn't quite accurate a
Menglin 2016/10/17 16:27:52 yeah i should've changed this in the last upload.
15 class COMPONENTS_PREFS_EXPORT CommandLinePrefStore : public ValueMapPrefStore {
16 public:
17 struct SwitchToPreferenceMapEntry {
18 const char* switch_name;
19 const char* preference_path;
20 };
21
22 // |set_value| indicates what the preference should be set to if the switch
23 // is present.
24 struct BooleanSwitchToPreferenceMapEntry {
25 const char* switch_name;
26 const char* preference_path;
27 bool set_value;
28 };
29
30 // Apply command-line switches to the corresponding preferences of the switch
31 // map, where the value associated with the switch is a string.
32 void ApplyStringSwitches(
33 const SwitchToPreferenceMapEntry string_switch_map[], size_t size);
34
35 // Apply command-line switches to the corresponding preferences of the switch
36 // map, where the value associated with the switch is a path.
37 void ApplyPathSwitches(const SwitchToPreferenceMapEntry path_switch_map[],
38 size_t size);
39
40 // Apply command-line switches to the corresponding preferences of the switch
41 // map, where the value associated with the switch is an integer.
42 void ApplyIntegerSwitches(
43 const SwitchToPreferenceMapEntry integer_switch_map[], size_t size);
44
45 // Apply command-line switches to the corresponding preferences of the
46 // boolean switch map.
47 void ApplyBooleanSwitches(
48 const BooleanSwitchToPreferenceMapEntry boolean_switch_map[],
49 size_t size);
50
51
52 protected:
53 explicit CommandLinePrefStore(const base::CommandLine* command_line);
54 ~CommandLinePrefStore() override;
55
56 const base::CommandLine* command_line() { return command_line_; }
57
58 private:
59 // Weak reference.
60 const base::CommandLine* command_line_;
61
62 DISALLOW_COPY_AND_ASSIGN(CommandLinePrefStore);
63 };
64
65 #endif // COMPONENTS_PREFS_COMMAND_LINE_PREF_STORE_H_
OLDNEW
« no previous file with comments | « components/prefs/BUILD.gn ('k') | components/prefs/command_line_pref_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698