OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_ABOUT_FLAGS_H_ | 5 #ifndef CHROME_BROWSER_ABOUT_FLAGS_H_ |
6 #define CHROME_BROWSER_ABOUT_FLAGS_H_ | 6 #define CHROME_BROWSER_ABOUT_FLAGS_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 base::string16 DescriptionForChoice(int index) const; | 105 base::string16 DescriptionForChoice(int index) const; |
106 }; | 106 }; |
107 | 107 |
108 // A flag controlling the behavior of the |ConvertFlagsToSwitches| function - | 108 // A flag controlling the behavior of the |ConvertFlagsToSwitches| function - |
109 // whether it should add the sentinel switches around flags. | 109 // whether it should add the sentinel switches around flags. |
110 enum SentinelsMode { kNoSentinels, kAddSentinels }; | 110 enum SentinelsMode { kNoSentinels, kAddSentinels }; |
111 | 111 |
112 // Reads the Labs |prefs| (called "Labs" for historical reasons) and adds the | 112 // Reads the Labs |prefs| (called "Labs" for historical reasons) and adds the |
113 // commandline flags belonging to the active experiments to |command_line|. | 113 // commandline flags belonging to the active experiments to |command_line|. |
114 void ConvertFlagsToSwitches(FlagsStorage* flags_storage, | 114 void ConvertFlagsToSwitches(FlagsStorage* flags_storage, |
115 CommandLine* command_line, | 115 base::CommandLine* command_line, |
116 SentinelsMode sentinels); | 116 SentinelsMode sentinels); |
117 | 117 |
118 // Compares a set of switches of the two provided command line objects and | 118 // Compares a set of switches of the two provided command line objects and |
119 // returns true if they are the same and false otherwise. | 119 // returns true if they are the same and false otherwise. |
120 bool AreSwitchesIdenticalToCurrentCommandLine( | 120 bool AreSwitchesIdenticalToCurrentCommandLine( |
121 const CommandLine& new_cmdline, const CommandLine& active_cmdline); | 121 const base::CommandLine& new_cmdline, |
| 122 const base::CommandLine& active_cmdline); |
122 | 123 |
123 // Differentiate between generic flags available on a per session base and flags | 124 // Differentiate between generic flags available on a per session base and flags |
124 // that influence the whole machine and can be said by the admin only. This flag | 125 // that influence the whole machine and can be said by the admin only. This flag |
125 // is relevant for ChromeOS for now only and dictates whether entries marked | 126 // is relevant for ChromeOS for now only and dictates whether entries marked |
126 // with the |kOsCrOSOwnerOnly| label should be enabled in the UI or not. | 127 // with the |kOsCrOSOwnerOnly| label should be enabled in the UI or not. |
127 enum FlagAccess { kGeneralAccessFlagsOnly, kOwnerAccessToFlags }; | 128 enum FlagAccess { kGeneralAccessFlagsOnly, kOwnerAccessToFlags }; |
128 | 129 |
129 // Get the list of experiments. Experiments that are available on the current | 130 // Get the list of experiments. Experiments that are available on the current |
130 // platform are appended to |supported_experiments|; all other experiments are | 131 // platform are appended to |supported_experiments|; all other experiments are |
131 // appended to |unsupported_experiments|. | 132 // appended to |unsupported_experiments|. |
132 void GetFlagsExperimentsData(FlagsStorage* flags_storage, | 133 void GetFlagsExperimentsData(FlagsStorage* flags_storage, |
133 FlagAccess access, | 134 FlagAccess access, |
134 base::ListValue* supported_experiments, | 135 base::ListValue* supported_experiments, |
135 base::ListValue* unsupported_experiments); | 136 base::ListValue* unsupported_experiments); |
136 | 137 |
137 // Returns true if one of the experiment flags has been flipped since startup. | 138 // Returns true if one of the experiment flags has been flipped since startup. |
138 bool IsRestartNeededToCommitChanges(); | 139 bool IsRestartNeededToCommitChanges(); |
139 | 140 |
140 // Enables or disables the experiment with id |internal_name|. | 141 // Enables or disables the experiment with id |internal_name|. |
141 void SetExperimentEnabled(FlagsStorage* flags_storage, | 142 void SetExperimentEnabled(FlagsStorage* flags_storage, |
142 const std::string& internal_name, | 143 const std::string& internal_name, |
143 bool enable); | 144 bool enable); |
144 | 145 |
145 // Removes all switches that were added to a command line by a previous call to | 146 // Removes all switches that were added to a command line by a previous call to |
146 // |ConvertFlagsToSwitches()|. | 147 // |ConvertFlagsToSwitches()|. |
147 void RemoveFlagsSwitches( | 148 void RemoveFlagsSwitches( |
148 std::map<std::string, CommandLine::StringType>* switch_list); | 149 std::map<std::string, base::CommandLine::StringType>* switch_list); |
149 | 150 |
150 // Reset all flags to the default state by clearing all flags. | 151 // Reset all flags to the default state by clearing all flags. |
151 void ResetAllFlags(FlagsStorage* flags_storage); | 152 void ResetAllFlags(FlagsStorage* flags_storage); |
152 | 153 |
153 // Returns the value for the current platform. This is one of the values defined | 154 // Returns the value for the current platform. This is one of the values defined |
154 // by the OS enum above. | 155 // by the OS enum above. |
155 // This is exposed only for testing. | 156 // This is exposed only for testing. |
156 int GetCurrentPlatform(); | 157 int GetCurrentPlatform(); |
157 | 158 |
158 // Sends UMA stats about experimental flag usage. This should be called once per | 159 // Sends UMA stats about experimental flag usage. This should be called once per |
(...skipping 14 matching lines...) Expand all Loading... |
173 | 174 |
174 // Separator used for multi values. Multi values are represented in prefs as | 175 // Separator used for multi values. Multi values are represented in prefs as |
175 // name-of-experiment + kMultiSeparator + selected_index. | 176 // name-of-experiment + kMultiSeparator + selected_index. |
176 extern const char kMultiSeparator[]; | 177 extern const char kMultiSeparator[]; |
177 | 178 |
178 } // namespace testing | 179 } // namespace testing |
179 | 180 |
180 } // namespace about_flags | 181 } // namespace about_flags |
181 | 182 |
182 #endif // CHROME_BROWSER_ABOUT_FLAGS_H_ | 183 #endif // CHROME_BROWSER_ABOUT_FLAGS_H_ |
OLD | NEW |