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

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

Issue 344883002: Collect UMA statistics on which chrome://flags lead to chrome restart on ChromeOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update after review. Created 6 years, 4 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') | chrome/browser/about_flags.cc » ('J')
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 <set>
9 #include <string> 10 #include <string>
10 11
11 #include "base/command_line.h" 12 #include "base/command_line.h"
12 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
13 14
14 class PrefService; 15 class PrefService;
15 16
16 namespace base { 17 namespace base {
17 class ListValue; 18 class ListValue;
18 } 19 }
19 20
20 namespace about_flags { 21 namespace about_flags {
21 22
22 class FlagsStorage; 23 class FlagsStorage;
23 24
25 // This value is reported as switch histogram ID if switch name has unknown
26 // format.
27 extern const uint32_t kBadSwitchFormatHistogramId;
28
24 // Enumeration of OSs. 29 // Enumeration of OSs.
25 // This is exposed only for testing. 30 // This is exposed only for testing.
26 enum { kOsMac = 1 << 0, kOsWin = 1 << 1, kOsLinux = 1 << 2 , kOsCrOS = 1 << 3, 31 enum { kOsMac = 1 << 0, kOsWin = 1 << 1, kOsLinux = 1 << 2 , kOsCrOS = 1 << 3,
27 kOsAndroid = 1 << 4, kOsCrOSOwnerOnly = 1 << 5 }; 32 kOsAndroid = 1 << 4, kOsCrOSOwnerOnly = 1 << 5 };
28 33
29 // Experiment is used internally by about_flags to describe an experiment (and 34 // Experiment is used internally by about_flags to describe an experiment (and
30 // for testing). 35 // for testing).
31 // This is exposed only for testing. 36 // This is exposed only for testing.
32 struct Experiment { 37 struct Experiment {
33 enum Type { 38 enum Type {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 enum SentinelsMode { kNoSentinels, kAddSentinels }; 115 enum SentinelsMode { kNoSentinels, kAddSentinels };
111 116
112 // Reads the Labs |prefs| (called "Labs" for historical reasons) and adds the 117 // Reads the Labs |prefs| (called "Labs" for historical reasons) and adds the
113 // commandline flags belonging to the active experiments to |command_line|. 118 // commandline flags belonging to the active experiments to |command_line|.
114 void ConvertFlagsToSwitches(FlagsStorage* flags_storage, 119 void ConvertFlagsToSwitches(FlagsStorage* flags_storage,
115 base::CommandLine* command_line, 120 base::CommandLine* command_line,
116 SentinelsMode sentinels); 121 SentinelsMode sentinels);
117 122
118 // Compares a set of switches of the two provided command line objects and 123 // Compares a set of switches of the two provided command line objects and
119 // returns true if they are the same and false otherwise. 124 // returns true if they are the same and false otherwise.
125 // If |out_difference| is not NULL, it's filled with set_symmetric_difference
126 // between sets.
120 bool AreSwitchesIdenticalToCurrentCommandLine( 127 bool AreSwitchesIdenticalToCurrentCommandLine(
121 const base::CommandLine& new_cmdline, 128 const base::CommandLine& new_cmdline,
122 const base::CommandLine& active_cmdline); 129 const base::CommandLine& active_cmdline,
130 std::set<CommandLine::StringType>* out_difference);
123 131
124 // Differentiate between generic flags available on a per session base and flags 132 // Differentiate between generic flags available on a per session base and flags
125 // that influence the whole machine and can be said by the admin only. This flag 133 // that influence the whole machine and can be said by the admin only. This flag
126 // is relevant for ChromeOS for now only and dictates whether entries marked 134 // is relevant for ChromeOS for now only and dictates whether entries marked
127 // with the |kOsCrOSOwnerOnly| label should be enabled in the UI or not. 135 // with the |kOsCrOSOwnerOnly| label should be enabled in the UI or not.
128 enum FlagAccess { kGeneralAccessFlagsOnly, kOwnerAccessToFlags }; 136 enum FlagAccess { kGeneralAccessFlagsOnly, kOwnerAccessToFlags };
129 137
130 // Get the list of experiments. Experiments that are available on the current 138 // Get the list of experiments. Experiments that are available on the current
131 // platform are appended to |supported_experiments|; all other experiments are 139 // platform are appended to |supported_experiments|; all other experiments are
132 // appended to |unsupported_experiments|. 140 // appended to |unsupported_experiments|.
(...skipping 20 matching lines...) Expand all
153 161
154 // Returns the value for the current platform. This is one of the values defined 162 // Returns the value for the current platform. This is one of the values defined
155 // by the OS enum above. 163 // by the OS enum above.
156 // This is exposed only for testing. 164 // This is exposed only for testing.
157 int GetCurrentPlatform(); 165 int GetCurrentPlatform();
158 166
159 // Sends UMA stats about experimental flag usage. This should be called once per 167 // Sends UMA stats about experimental flag usage. This should be called once per
160 // startup. 168 // startup.
161 void RecordUMAStatistics(FlagsStorage* flags_storage); 169 void RecordUMAStatistics(FlagsStorage* flags_storage);
162 170
171 // Returns the UMA id for the specified switch name.
172 uint32 GetSwitchUMAId(const std::string& switch_name);
Ilya Sherman 2014/08/05 20:14:46 Please be consistent about the integer types you u
Alexander Alekseev 2014/08/07 23:24:56 Done.
173
174 // Sends stats (as UMA histogram) about command_line_difference.
175 // This is used on ChromeOS to report flags that lead to browser restart.
176 // |command_line_difference| is the result of
177 // AreSwitchesIdenticalToCurrentCommandLine().
178 void ReportCustomFlags(const std::string& uma_histogram_hame,
179 const std::set<std::string>& command_line_difference);
180
181 // Returns list of all command-line switches used in flags.
182 std::set<std::string> GetAllSwitchesForTesting();
183
163 namespace testing { 184 namespace testing {
164 185
165 // Clears internal global state, for unit tests. 186 // Clears internal global state, for unit tests.
166 void ClearState(); 187 void ClearState();
167 188
168 // 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
169 // NOT take ownership of the supplied Experiments. 190 // NOT take ownership of the supplied Experiments.
170 void SetExperiments(const Experiment* e, size_t count); 191 void SetExperiments(const Experiment* e, size_t count);
171 192
172 // Returns the current set of experiments. 193 // Returns the current set of experiments.
173 const Experiment* GetExperiments(size_t* count); 194 const Experiment* GetExperiments(size_t* count);
174 195
175 // 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
176 // name-of-experiment + kMultiSeparator + selected_index. 197 // name-of-experiment + kMultiSeparator + selected_index.
177 extern const char kMultiSeparator[]; 198 extern const char kMultiSeparator[];
178 199
179 } // namespace testing 200 } // namespace testing
180 201
181 } // namespace about_flags 202 } // namespace about_flags
182 203
183 #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') | chrome/browser/about_flags.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698