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

Side by Side Diff: components/metrics/net/cellular_logic_helper.cc

Issue 2351873002: Clean up UMA 3g experiment and unify metrics enabled pref for Android (Closed)
Patch Set: remove optimization param Created 4 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 | « components/metrics/metrics_service_accessor.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "components/metrics/net/cellular_logic_helper.h" 5 #include "components/metrics/net/cellular_logic_helper.h"
6 6
7 #include "components/variations/variations_associated_data.h"
8 #include "net/base/network_change_notifier.h" 7 #include "net/base/network_change_notifier.h"
9 8
10 namespace metrics { 9 namespace metrics {
11 10
12 namespace { 11 namespace {
13 12
14 // Standard interval between log uploads, in seconds. 13 // Standard interval between log uploads, in seconds.
15 #if defined(OS_ANDROID) || defined(OS_IOS) 14 #if defined(OS_ANDROID) || defined(OS_IOS)
16 const int kStandardUploadIntervalSeconds = 5 * 60; // Five minutes. 15 const int kStandardUploadIntervalSeconds = 5 * 60; // Five minutes.
17 const int kStandardUploadIntervalCellularSeconds = 15 * 60; // Fifteen minutes. 16 const int kStandardUploadIntervalCellularSeconds = 15 * 60; // Fifteen minutes.
18 #else 17 #else
19 const int kStandardUploadIntervalSeconds = 30 * 60; // Thirty minutes. 18 const int kStandardUploadIntervalSeconds = 30 * 60; // Thirty minutes.
20 #endif 19 #endif
21 20
22 #if defined(OS_ANDROID) 21 #if defined(OS_ANDROID)
23 const bool kDefaultCellularLogicEnabled = true; 22 const bool kDefaultCellularLogicEnabled = true;
24 const bool kDefaultCellularLogicOptimization = true;
25 #else 23 #else
26 const bool kDefaultCellularLogicEnabled = false; 24 const bool kDefaultCellularLogicEnabled = false;
27 const bool kDefaultCellularLogicOptimization = false;
28 #endif 25 #endif
29 26
30 } // namespace 27 } // namespace
31 28
32 base::TimeDelta GetUploadInterval() { 29 base::TimeDelta GetUploadInterval() {
33 #if defined(OS_ANDROID) || defined(OS_IOS) 30 #if defined(OS_ANDROID) || defined(OS_IOS)
34 if (IsCellularLogicEnabled()) 31 if (IsCellularLogicEnabled())
35 return base::TimeDelta::FromSeconds(kStandardUploadIntervalCellularSeconds); 32 return base::TimeDelta::FromSeconds(kStandardUploadIntervalCellularSeconds);
36 #endif 33 #endif
37 return base::TimeDelta::FromSeconds(kStandardUploadIntervalSeconds); 34 return base::TimeDelta::FromSeconds(kStandardUploadIntervalSeconds);
38 } 35 }
39 36
40 // Returns true if current connection type is cellular and user is assigned to 37 // Returns true if current connection type is cellular and cellular logic is
41 // experimental group for enabled cellular uploads. 38 // enabled.
42 bool IsCellularLogicEnabled() { 39 bool IsCellularLogicEnabled() {
43 std::string enabled = variations::GetVariationParamValue( 40 if (!kDefaultCellularLogicEnabled)
44 "UMA_EnableCellularLogUpload", "Enabled");
45 std::string optimized = variations::GetVariationParamValue(
46 "UMA_EnableCellularLogUpload", "Optimize");
47 bool is_enabled = kDefaultCellularLogicEnabled;
48 if (!enabled.empty())
49 is_enabled = (enabled == "true");
50
51 bool is_optimized = kDefaultCellularLogicOptimization;
52 if (!optimized.empty())
53 is_optimized = (optimized == "true");
54
55 if (!is_enabled || !is_optimized)
56 return false; 41 return false;
57 42
58 return net::NetworkChangeNotifier::IsConnectionCellular( 43 return net::NetworkChangeNotifier::IsConnectionCellular(
59 net::NetworkChangeNotifier::GetConnectionType()); 44 net::NetworkChangeNotifier::GetConnectionType());
60 } 45 }
61 46
62 } // namespace metrics 47 } // namespace metrics
OLDNEW
« no previous file with comments | « components/metrics/metrics_service_accessor.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698