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

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

Issue 509923003: about_flags::ReportCustomFlags() should use signed 32-bit IDs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup. Created 6 years, 3 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
« 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 <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/metrics/histogram_base.h"
15 #include "base/strings/string16.h" 16 #include "base/strings/string16.h"
16 17
17 class PrefService; 18 class PrefService;
18 19
19 namespace base { 20 namespace base {
20 class ListValue; 21 class ListValue;
21 } 22 }
22 23
23 namespace about_flags { 24 namespace about_flags {
24 25
25 class FlagsStorage; 26 class FlagsStorage;
26 27
27 // This value is reported as switch histogram ID if switch name has unknown 28 // This value is reported as switch histogram ID if switch name has unknown
28 // format. 29 // format.
29 extern const uint32_t kBadSwitchFormatHistogramId; 30 extern const base::HistogramBase::Sample kBadSwitchFormatHistogramId;
30 31
31 // Enumeration of OSs. 32 // Enumeration of OSs.
32 // This is exposed only for testing. 33 // This is exposed only for testing.
33 enum { kOsMac = 1 << 0, kOsWin = 1 << 1, kOsLinux = 1 << 2 , kOsCrOS = 1 << 3, 34 enum { kOsMac = 1 << 0, kOsWin = 1 << 1, kOsLinux = 1 << 2 , kOsCrOS = 1 << 3,
34 kOsAndroid = 1 << 4, kOsCrOSOwnerOnly = 1 << 5 }; 35 kOsAndroid = 1 << 4, kOsCrOSOwnerOnly = 1 << 5 };
35 36
36 // Experiment is used internally by about_flags to describe an experiment (and 37 // Experiment is used internally by about_flags to describe an experiment (and
37 // for testing). 38 // for testing).
38 // This is exposed only for testing. 39 // This is exposed only for testing.
39 struct Experiment { 40 struct Experiment {
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 // Returns the value for the current platform. This is one of the values defined 165 // Returns the value for the current platform. This is one of the values defined
165 // by the OS enum above. 166 // by the OS enum above.
166 // This is exposed only for testing. 167 // This is exposed only for testing.
167 int GetCurrentPlatform(); 168 int GetCurrentPlatform();
168 169
169 // Sends UMA stats about experimental flag usage. This should be called once per 170 // Sends UMA stats about experimental flag usage. This should be called once per
170 // startup. 171 // startup.
171 void RecordUMAStatistics(FlagsStorage* flags_storage); 172 void RecordUMAStatistics(FlagsStorage* flags_storage);
172 173
173 // Returns the UMA id for the specified switch name. 174 // Returns the UMA id for the specified switch name.
174 uint32_t GetSwitchUMAId(const std::string& switch_name); 175 base::HistogramBase::Sample GetSwitchUMAId(const std::string& switch_name);
175 176
176 // Sends stats (as UMA histogram) about command_line_difference. 177 // Sends stats (as UMA histogram) about command_line_difference.
177 // This is used on ChromeOS to report flags that lead to browser restart. 178 // This is used on ChromeOS to report flags that lead to browser restart.
178 // |command_line_difference| is the result of 179 // |command_line_difference| is the result of
179 // AreSwitchesIdenticalToCurrentCommandLine(). 180 // AreSwitchesIdenticalToCurrentCommandLine().
180 void ReportCustomFlags(const std::string& uma_histogram_hame, 181 void ReportCustomFlags(const std::string& uma_histogram_hame,
181 const std::set<std::string>& command_line_difference); 182 const std::set<std::string>& command_line_difference);
182 183
183 namespace testing { 184 namespace testing {
184 185
185 // Clears internal global state, for unit tests. 186 // Clears internal global state, for unit tests.
186 void ClearState(); 187 void ClearState();
187 188
188 // Sets the list of experiments. Pass in NULL to use the default set. This does 189 // Sets the list of experiments. Pass in NULL to use the default set. This does
189 // NOT take ownership of the supplied Experiments. 190 // NOT take ownership of the supplied Experiments.
190 void SetExperiments(const Experiment* e, size_t count); 191 void SetExperiments(const Experiment* e, size_t count);
191 192
192 // Returns the current set of experiments. 193 // Returns the current set of experiments.
193 const Experiment* GetExperiments(size_t* count); 194 const Experiment* GetExperiments(size_t* count);
194 195
195 // Separator used for multi values. Multi values are represented in prefs as 196 // Separator used for multi values. Multi values are represented in prefs as
196 // name-of-experiment + kMultiSeparator + selected_index. 197 // name-of-experiment + kMultiSeparator + selected_index.
197 extern const char kMultiSeparator[]; 198 extern const char kMultiSeparator[];
198 199
199 } // namespace testing 200 } // namespace testing
200 201
201 } // namespace about_flags 202 } // namespace about_flags
202 203
203 #endif // CHROME_BROWSER_ABOUT_FLAGS_H_ 204 #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