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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <set> | 11 #include <set> |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
16 | 16 |
17 class PrefService; | 17 class PrefService; |
18 | 18 |
19 namespace base { | 19 namespace base { |
20 class ListValue; | 20 class ListValue; |
21 } | 21 } |
22 | 22 |
23 namespace about_flags { | 23 namespace about_flags { |
24 | 24 |
25 class FlagsStorage; | 25 class FlagsStorage; |
26 | 26 |
27 // This value is reported as switch histogram ID if switch name has unknown | 27 // This value is reported as switch histogram ID if switch name has unknown |
28 // format. | 28 // format. |
29 extern const uint32_t kBadSwitchFormatHistogramId; | 29 extern const int32_t kBadSwitchFormatHistogramId; |
30 | 30 |
31 // Enumeration of OSs. | 31 // Enumeration of OSs. |
32 // This is exposed only for testing. | 32 // This is exposed only for testing. |
33 enum { kOsMac = 1 << 0, kOsWin = 1 << 1, kOsLinux = 1 << 2 , kOsCrOS = 1 << 3, | 33 enum { kOsMac = 1 << 0, kOsWin = 1 << 1, kOsLinux = 1 << 2 , kOsCrOS = 1 << 3, |
34 kOsAndroid = 1 << 4, kOsCrOSOwnerOnly = 1 << 5 }; | 34 kOsAndroid = 1 << 4, kOsCrOSOwnerOnly = 1 << 5 }; |
35 | 35 |
36 // Experiment is used internally by about_flags to describe an experiment (and | 36 // Experiment is used internally by about_flags to describe an experiment (and |
37 // for testing). | 37 // for testing). |
38 // This is exposed only for testing. | 38 // This is exposed only for testing. |
39 struct Experiment { | 39 struct Experiment { |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
164 // Returns the value for the current platform. This is one of the values defined | 164 // Returns the value for the current platform. This is one of the values defined |
165 // by the OS enum above. | 165 // by the OS enum above. |
166 // This is exposed only for testing. | 166 // This is exposed only for testing. |
167 int GetCurrentPlatform(); | 167 int GetCurrentPlatform(); |
168 | 168 |
169 // Sends UMA stats about experimental flag usage. This should be called once per | 169 // Sends UMA stats about experimental flag usage. This should be called once per |
170 // startup. | 170 // startup. |
171 void RecordUMAStatistics(FlagsStorage* flags_storage); | 171 void RecordUMAStatistics(FlagsStorage* flags_storage); |
172 | 172 |
173 // Returns the UMA id for the specified switch name. | 173 // Returns the UMA id for the specified switch name. |
174 uint32_t GetSwitchUMAId(const std::string& switch_name); | 174 int32_t GetSwitchUMAId(const std::string& switch_name); |
sky
2014/09/02 17:13:22
How come you aren't using base::HistogramBase::Sa
Alexander Alekseev
2014/09/02 17:59:32
Done.
Sorry, I missed it.
| |
175 | 175 |
176 // Sends stats (as UMA histogram) about command_line_difference. | 176 // Sends stats (as UMA histogram) about command_line_difference. |
177 // This is used on ChromeOS to report flags that lead to browser restart. | 177 // This is used on ChromeOS to report flags that lead to browser restart. |
178 // |command_line_difference| is the result of | 178 // |command_line_difference| is the result of |
179 // AreSwitchesIdenticalToCurrentCommandLine(). | 179 // AreSwitchesIdenticalToCurrentCommandLine(). |
180 void ReportCustomFlags(const std::string& uma_histogram_hame, | 180 void ReportCustomFlags(const std::string& uma_histogram_hame, |
181 const std::set<std::string>& command_line_difference); | 181 const std::set<std::string>& command_line_difference); |
182 | 182 |
183 namespace testing { | 183 namespace testing { |
184 | 184 |
185 // Clears internal global state, for unit tests. | 185 // Clears internal global state, for unit tests. |
186 void ClearState(); | 186 void ClearState(); |
187 | 187 |
188 // Sets the list of experiments. Pass in NULL to use the default set. This does | 188 // Sets the list of experiments. Pass in NULL to use the default set. This does |
189 // NOT take ownership of the supplied Experiments. | 189 // NOT take ownership of the supplied Experiments. |
190 void SetExperiments(const Experiment* e, size_t count); | 190 void SetExperiments(const Experiment* e, size_t count); |
191 | 191 |
192 // Returns the current set of experiments. | 192 // Returns the current set of experiments. |
193 const Experiment* GetExperiments(size_t* count); | 193 const Experiment* GetExperiments(size_t* count); |
194 | 194 |
195 // Separator used for multi values. Multi values are represented in prefs as | 195 // Separator used for multi values. Multi values are represented in prefs as |
196 // name-of-experiment + kMultiSeparator + selected_index. | 196 // name-of-experiment + kMultiSeparator + selected_index. |
197 extern const char kMultiSeparator[]; | 197 extern const char kMultiSeparator[]; |
198 | 198 |
199 } // namespace testing | 199 } // namespace testing |
200 | 200 |
201 } // namespace about_flags | 201 } // namespace about_flags |
202 | 202 |
203 #endif // CHROME_BROWSER_ABOUT_FLAGS_H_ | 203 #endif // CHROME_BROWSER_ABOUT_FLAGS_H_ |
OLD | NEW |