| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 | 13 |
| 14 class PrefService; |
| 15 |
| 16 namespace base { |
| 14 class ListValue; | 17 class ListValue; |
| 15 class PrefService; | 18 } |
| 16 | 19 |
| 17 namespace about_flags { | 20 namespace about_flags { |
| 18 | 21 |
| 19 // Enumeration of OSs. | 22 // Enumeration of OSs. |
| 20 // This is exposed only for testing. | 23 // This is exposed only for testing. |
| 21 enum { kOsMac = 1 << 0, kOsWin = 1 << 1, kOsLinux = 1 << 2 , kOsCrOS = 1 << 3 }; | 24 enum { kOsMac = 1 << 0, kOsWin = 1 << 1, kOsLinux = 1 << 2 , kOsCrOS = 1 << 3 }; |
| 22 | 25 |
| 23 // Experiment is used internally by about_flags to describe an experiment (and | 26 // Experiment is used internally by about_flags to describe an experiment (and |
| 24 // for testing). | 27 // for testing). |
| 25 // This is exposed only for testing. | 28 // This is exposed only for testing. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 // Number of |choices|. | 83 // Number of |choices|. |
| 81 // This is used if type is MULTI_VALUE. | 84 // This is used if type is MULTI_VALUE. |
| 82 int num_choices; | 85 int num_choices; |
| 83 }; | 86 }; |
| 84 | 87 |
| 85 // Reads the Labs |prefs| (called "Labs" for historical reasons) and adds the | 88 // Reads the Labs |prefs| (called "Labs" for historical reasons) and adds the |
| 86 // commandline flags belonging to the active experiments to |command_line|. | 89 // commandline flags belonging to the active experiments to |command_line|. |
| 87 void ConvertFlagsToSwitches(PrefService* prefs, CommandLine* command_line); | 90 void ConvertFlagsToSwitches(PrefService* prefs, CommandLine* command_line); |
| 88 | 91 |
| 89 // Get a list of all available experiments. The caller owns the result. | 92 // Get a list of all available experiments. The caller owns the result. |
| 90 ListValue* GetFlagsExperimentsData(PrefService* prefs); | 93 base::ListValue* GetFlagsExperimentsData(PrefService* prefs); |
| 91 | 94 |
| 92 // Returns true if one of the experiment flags has been flipped since startup. | 95 // Returns true if one of the experiment flags has been flipped since startup. |
| 93 bool IsRestartNeededToCommitChanges(); | 96 bool IsRestartNeededToCommitChanges(); |
| 94 | 97 |
| 95 // Enables or disables the experiment with id |internal_name|. | 98 // Enables or disables the experiment with id |internal_name|. |
| 96 void SetExperimentEnabled( | 99 void SetExperimentEnabled( |
| 97 PrefService* prefs, const std::string& internal_name, bool enable); | 100 PrefService* prefs, const std::string& internal_name, bool enable); |
| 98 | 101 |
| 99 // Removes all switches that were added to a command line by a previous call to | 102 // Removes all switches that were added to a command line by a previous call to |
| 100 // |ConvertFlagsToSwitches()|. | 103 // |ConvertFlagsToSwitches()|. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 123 | 126 |
| 124 // Separator used for multi values. Multi values are represented in prefs as | 127 // Separator used for multi values. Multi values are represented in prefs as |
| 125 // name-of-experiment + kMultiSeparator + selected_index. | 128 // name-of-experiment + kMultiSeparator + selected_index. |
| 126 extern const char kMultiSeparator[]; | 129 extern const char kMultiSeparator[]; |
| 127 | 130 |
| 128 } // namespace testing | 131 } // namespace testing |
| 129 | 132 |
| 130 } // namespace about_flags | 133 } // namespace about_flags |
| 131 | 134 |
| 132 #endif // CHROME_BROWSER_ABOUT_FLAGS_H_ | 135 #endif // CHROME_BROWSER_ABOUT_FLAGS_H_ |
| OLD | NEW |