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

Side by Side Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.h

Issue 1400903002: Data reduction proxy enabled/disabled UMA for all platforms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix for trybot components_unittests failure Created 5 years, 2 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_SETTIN GS_H_ 5 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_SETTIN GS_H_
6 #define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_SETTIN GS_H_ 6 #define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_SETTIN GS_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 // This enum must remain synchronized with 48 // This enum must remain synchronized with
49 // DataReductionProxyLoFiImplicitOptOutAction in 49 // DataReductionProxyLoFiImplicitOptOutAction in
50 // metrics/histograms/histograms.xml. 50 // metrics/histograms/histograms.xml.
51 enum LoFiImplicitOptOutAction { 51 enum LoFiImplicitOptOutAction {
52 LO_FI_OPT_OUT_ACTION_DISABLED_FOR_SESSION = 0, 52 LO_FI_OPT_OUT_ACTION_DISABLED_FOR_SESSION = 0,
53 LO_FI_OPT_OUT_ACTION_DISABLED_UNTIL_NEXT_EPOCH, 53 LO_FI_OPT_OUT_ACTION_DISABLED_UNTIL_NEXT_EPOCH,
54 LO_FI_OPT_OUT_ACTION_NEXT_EPOCH, 54 LO_FI_OPT_OUT_ACTION_NEXT_EPOCH,
55 LO_FI_OPT_OUT_ACTION_INDEX_BOUNDARY, 55 LO_FI_OPT_OUT_ACTION_INDEX_BOUNDARY,
56 }; 56 };
57 57
58 // Values of the UMA DataReductionProxy.EnabledState histogram.
59 // This enum must remain synchronized with
60 // DataReductionProxyEnabledState in
61 // metrics/histograms/histograms.xml.
62 enum DataReductionSettingsEnabledAction {
63 DATA_REDUCTION_SETTINGS_ACTION_OFF_TO_ON = 0,
64 DATA_REDUCTION_SETTINGS_ACTION_ON_TO_OFF,
65 DATA_REDUCTION_SETTINGS_ACTION_BOUNDARY,
66 };
67
58 // Central point for configuring the data reduction proxy. 68 // Central point for configuring the data reduction proxy.
59 // This object lives on the UI thread and all of its methods are expected to 69 // This object lives on the UI thread and all of its methods are expected to
60 // be called from there. 70 // be called from there.
61 // TODO(marq): Convert this to be a KeyedService with an 71 // TODO(marq): Convert this to be a KeyedService with an
62 // associated factory class, and refactor the Java call sites accordingly. 72 // associated factory class, and refactor the Java call sites accordingly.
63 class DataReductionProxySettings : public DataReductionProxyServiceObserver { 73 class DataReductionProxySettings : public DataReductionProxyServiceObserver {
64 public: 74 public:
65 typedef base::Callback<bool(const std::string&, const std::string&)> 75 typedef base::Callback<bool(const std::string&, const std::string&)>
66 SyntheticFieldTrialRegistrationCallback; 76 SyntheticFieldTrialRegistrationCallback;
67 77
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 208
199 // Metrics method. Subclasses should override if they wish to provide 209 // Metrics method. Subclasses should override if they wish to provide
200 // alternatives. 210 // alternatives.
201 virtual void RecordDataReductionInit(); 211 virtual void RecordDataReductionInit();
202 212
203 // Virtualized for mocking. Records UMA specifying whether the proxy was 213 // Virtualized for mocking. Records UMA specifying whether the proxy was
204 // enabled or disabled at startup. 214 // enabled or disabled at startup.
205 virtual void RecordStartupState( 215 virtual void RecordStartupState(
206 data_reduction_proxy::ProxyStartupState state); 216 data_reduction_proxy::ProxyStartupState state);
207 217
218 // Virtualized for mocking. Records UMA whenever user toggles the
219 // ON/OFF in settings UI
220 virtual void RecordSettingsEnabledState(
221 data_reduction_proxy::DataReductionSettingsEnabledAction action);
222
208 private: 223 private:
209 friend class DataReductionProxySettingsTestBase; 224 friend class DataReductionProxySettingsTestBase;
210 friend class DataReductionProxySettingsTest; 225 friend class DataReductionProxySettingsTest;
211 friend class DataReductionProxyTestContext; 226 friend class DataReductionProxyTestContext;
212 FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsTest, 227 FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsTest,
213 TestResetDataReductionStatistics); 228 TestResetDataReductionStatistics);
214 FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsTest, 229 FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsTest,
215 TestIsProxyEnabledOrManaged); 230 TestIsProxyEnabledOrManaged);
216 FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsTest, 231 FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsTest,
217 TestCanUseDataReductionProxy); 232 TestCanUseDataReductionProxy);
(...skipping 11 matching lines...) Expand all
229 FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsTest, 244 FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsTest,
230 CheckInitMetricsWhenNotAllowed); 245 CheckInitMetricsWhenNotAllowed);
231 FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsTest, 246 FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsTest,
232 TestLoFiImplicitOptOutClicksPerSession); 247 TestLoFiImplicitOptOutClicksPerSession);
233 FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsTest, 248 FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsTest,
234 TestLoFiImplicitOptOutConsecutiveSessions); 249 TestLoFiImplicitOptOutConsecutiveSessions);
235 FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsTest, 250 FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsTest,
236 TestLoFiImplicitOptOutHistograms); 251 TestLoFiImplicitOptOutHistograms);
237 FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsTest, 252 FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsTest,
238 TestLoFiSessionStateHistograms); 253 TestLoFiSessionStateHistograms);
254 FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsTest,
sclittle 2015/10/09 20:52:48 I don't think you need this FRIEND_TEST_ALL_PREFIX
Raj 2015/10/10 01:51:47 TestSettingsEnabledStateHistograms() calls setting
255 TestSettingsEnabledStateHistograms);
239 256
240 // Override of DataReductionProxyService::Observer. 257 // Override of DataReductionProxyService::Observer.
241 void OnServiceInitialized() override; 258 void OnServiceInitialized() override;
242 259
243 // Registers the trial "SyntheticDataReductionProxySetting" with the group 260 // Registers the trial "SyntheticDataReductionProxySetting" with the group
244 // "Enabled" or "Disabled". Indicates whether the proxy is turned on or not. 261 // "Enabled" or "Disabled". Indicates whether the proxy is turned on or not.
245 void RegisterDataReductionProxyFieldTrial(); 262 void RegisterDataReductionProxyFieldTrial();
246 263
247 // Registers the trial "SyntheticDataReductionProxyLoFiSetting" with the group 264 // Registers the trial "SyntheticDataReductionProxyLoFiSetting" with the group
248 // "Enabled" or "Disabled". Indicates whether Lo-Fi is turned on or not. 265 // "Enabled" or "Disabled". Indicates whether Lo-Fi is turned on or not.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 SyntheticFieldTrialRegistrationCallback register_synthetic_field_trial_; 319 SyntheticFieldTrialRegistrationCallback register_synthetic_field_trial_;
303 320
304 base::ThreadChecker thread_checker_; 321 base::ThreadChecker thread_checker_;
305 322
306 DISALLOW_COPY_AND_ASSIGN(DataReductionProxySettings); 323 DISALLOW_COPY_AND_ASSIGN(DataReductionProxySettings);
307 }; 324 };
308 325
309 } // namespace data_reduction_proxy 326 } // namespace data_reduction_proxy
310 327
311 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_SET TINGS_H_ 328 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_SET TINGS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698