Fix emulator build error
[platform/framework/web/chromium-efl.git] / components / prefs / command_line_pref_store.h
1 // Copyright 2016 The Chromium Authors
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/containers/span.h"
9 #include "base/memory/raw_ptr.h"
10 #include "components/prefs/value_map_pref_store.h"
11
12 namespace base {
13 class CommandLine;
14 }
15
16 // Base class for a PrefStore that maps command line switches to preferences.
17 // The Apply...Switches() methods can be called by subclasses with their own
18 // maps, or delegated to other code.
19 class COMPONENTS_PREFS_EXPORT CommandLinePrefStore : public ValueMapPrefStore {
20  public:
21   struct SwitchToPreferenceMapEntry {
22     const char* switch_name;
23     const char* preference_path;
24   };
25
26   // |set_value| indicates what the preference should be set to if the switch
27   // is present.
28   struct BooleanSwitchToPreferenceMapEntry {
29     const char* switch_name;
30     const char* preference_path;
31     bool set_value;
32   };
33
34   CommandLinePrefStore(const CommandLinePrefStore&) = delete;
35   CommandLinePrefStore& operator=(const CommandLinePrefStore&) = delete;
36
37   // Apply command-line switches to the corresponding preferences of the switch
38   // map, where the value associated with the switch is a string.
39   void ApplyStringSwitches(
40       base::span<const SwitchToPreferenceMapEntry> string_switch_map);
41
42   // Apply command-line switches to the corresponding preferences of the switch
43   // map, where the value associated with the switch is a path.
44   void ApplyPathSwitches(
45       base::span<const SwitchToPreferenceMapEntry> path_switch_map);
46
47   // Apply command-line switches to the corresponding preferences of the switch
48   // map, where the value associated with the switch is an integer.
49   void ApplyIntegerSwitches(
50       base::span<const SwitchToPreferenceMapEntry> integer_switch_map);
51
52   // Apply command-line switches to the corresponding preferences of the
53   // boolean switch map.
54   void ApplyBooleanSwitches(
55       base::span<const BooleanSwitchToPreferenceMapEntry> boolean_switch_map);
56
57  protected:
58   explicit CommandLinePrefStore(const base::CommandLine* command_line);
59   ~CommandLinePrefStore() override;
60
61   const base::CommandLine* command_line() { return command_line_; }
62
63  private:
64   // Weak reference.
65   raw_ptr<const base::CommandLine> command_line_;
66 };
67
68 #endif  // COMPONENTS_PREFS_COMMAND_LINE_PREF_STORE_H_