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

Side by Side Diff: chrome/browser/about_flags.h

Issue 13467023: Add differentiation between owner only and common flags on ChromeOS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/about_flags.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/string16.h" 12 #include "base/string16.h"
13 13
14 class PrefService; 14 class PrefService;
15 15
16 namespace base { 16 namespace base {
17 class ListValue; 17 class ListValue;
18 } 18 }
19 19
20 namespace about_flags { 20 namespace about_flags {
21 21
22 // Enumeration of OSs. 22 // Enumeration of OSs.
23 // This is exposed only for testing. 23 // This is exposed only for testing.
24 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,
25 kOsAndroid = 1 << 4 }; 25 kOsAndroid = 1 << 4, kOsCrOSOwnerOnly = 1 << 5 };
26 26
27 // Experiment is used internally by about_flags to describe an experiment (and 27 // Experiment is used internally by about_flags to describe an experiment (and
28 // for testing). 28 // for testing).
29 // This is exposed only for testing. 29 // This is exposed only for testing.
30 struct Experiment { 30 struct Experiment {
31 enum Type { 31 enum Type {
32 // An experiment with a single value. This is typically what you want. 32 // An experiment with a single value. This is typically what you want.
33 SINGLE_VALUE, 33 SINGLE_VALUE,
34 34
35 // The experiment has multiple values only one of which is ever enabled. 35 // The experiment has multiple values only one of which is ever enabled.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 101
102 // Returns the human readable description for the choice at |index|. 102 // Returns the human readable description for the choice at |index|.
103 string16 DescriptionForChoice(int index) const; 103 string16 DescriptionForChoice(int index) const;
104 }; 104 };
105 105
106 // Reads the Labs |prefs| (called "Labs" for historical reasons) and adds the 106 // Reads the Labs |prefs| (called "Labs" for historical reasons) and adds the
107 // commandline flags belonging to the active experiments to |command_line|. 107 // commandline flags belonging to the active experiments to |command_line|.
108 void ConvertFlagsToSwitches(PrefService* prefs, CommandLine* command_line); 108 void ConvertFlagsToSwitches(PrefService* prefs, CommandLine* command_line);
109 109
110 // Get a list of all available experiments. The caller owns the result. 110 // Get a list of all available experiments. The caller owns the result.
111 base::ListValue* GetFlagsExperimentsData(PrefService* prefs); 111 base::ListValue* GetFlagsExperimentsData(PrefService* prefs, bool owner);
112 112
113 // Returns true if one of the experiment flags has been flipped since startup. 113 // Returns true if one of the experiment flags has been flipped since startup.
114 bool IsRestartNeededToCommitChanges(); 114 bool IsRestartNeededToCommitChanges();
115 115
116 // Enables or disables the experiment with id |internal_name|. 116 // Enables or disables the experiment with id |internal_name|.
117 void SetExperimentEnabled( 117 void SetExperimentEnabled(
118 PrefService* prefs, const std::string& internal_name, bool enable); 118 PrefService* prefs, const std::string& internal_name, bool enable);
119 119
120 // Removes all switches that were added to a command line by a previous call to 120 // Removes all switches that were added to a command line by a previous call to
121 // |ConvertFlagsToSwitches()|. 121 // |ConvertFlagsToSwitches()|.
122 void RemoveFlagsSwitches( 122 void RemoveFlagsSwitches(
123 std::map<std::string, CommandLine::StringType>* switch_list); 123 std::map<std::string, CommandLine::StringType>* switch_list);
124 124
125 // Reset all flags to the default state by clearing all flags. 125 // Reset all flags to the default state by clearing all flags.
126 void ResetAllFlags(PrefService* prefs); 126 void ResetAllFlags(PrefService* prefs);
127 127
128 // Returns the value for the current platform. This is one of the values defined 128 // Returns the value for the current platform. This is one of the values defined
129 // by the OS enum above. 129 // by the OS enum above.
Nico 2013/04/08 19:24:10 This comment is now no longer true.
pastarmovj 2013/04/09 09:17:49 It still is. I never added a new call to this dire
Nico 2013/04/09 15:38:26 Right, but if the parameter is true this returns "
130 // This is exposed only for testing. 130 // This is exposed only for testing.
131 int GetCurrentPlatform(); 131 int GetCurrentPlatform(bool owner);
132 132
133 // Sends UMA stats about experimental flag usage. This should be called once per 133 // Sends UMA stats about experimental flag usage. This should be called once per
134 // startup. 134 // startup.
135 void RecordUMAStatistics(const PrefService* prefs); 135 void RecordUMAStatistics(const PrefService* prefs);
136 136
137 namespace testing { 137 namespace testing {
138 138
139 // Clears internal global state, for unit tests. 139 // Clears internal global state, for unit tests.
140 void ClearState(); 140 void ClearState();
141 141
142 // Sets the list of experiments. Pass in NULL to use the default set. This does 142 // Sets the list of experiments. Pass in NULL to use the default set. This does
143 // NOT take ownership of the supplied Experiments. 143 // NOT take ownership of the supplied Experiments.
144 void SetExperiments(const Experiment* e, size_t count); 144 void SetExperiments(const Experiment* e, size_t count);
145 145
146 // Returns the current set of experiments. 146 // Returns the current set of experiments.
147 const Experiment* GetExperiments(size_t* count); 147 const Experiment* GetExperiments(size_t* count);
148 148
149 // Separator used for multi values. Multi values are represented in prefs as 149 // Separator used for multi values. Multi values are represented in prefs as
150 // name-of-experiment + kMultiSeparator + selected_index. 150 // name-of-experiment + kMultiSeparator + selected_index.
151 extern const char kMultiSeparator[]; 151 extern const char kMultiSeparator[];
152 152
153 } // namespace testing 153 } // namespace testing
154 154
155 } // namespace about_flags 155 } // namespace about_flags
156 156
157 #endif // CHROME_BROWSER_ABOUT_FLAGS_H_ 157 #endif // CHROME_BROWSER_ABOUT_FLAGS_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/about_flags.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698