Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/chrome_browser_metrics_service_observer.h" | |
| 6 | |
| 7 #include "chrome/browser/metrics/metrics_service.h" | |
| 8 | |
| 9 #if defined(OS_ANDROID) | |
| 10 #include "base/metrics/sparse_histogram.h" | |
| 11 #include "base/strings/string_number_conversions.h" | |
| 12 #include "net/android/network_library.h" | |
| 13 #endif | |
| 14 | |
| 15 ChromeBrowserMetricsServiceObserver::ChromeBrowserMetricsServiceObserver() { | |
| 16 MetricsServiceHelper::AddMetricsServiceObserver(this); | |
| 17 } | |
| 18 | |
| 19 ChromeBrowserMetricsServiceObserver::~ChromeBrowserMetricsServiceObserver() { | |
| 20 MetricsServiceHelper::RemoveMetricsServiceObserver(this); | |
| 21 } | |
| 22 | |
| 23 void ChromeBrowserMetricsServiceObserver::OnDidCreateMetricsLog() { | |
| 24 #if defined(OS_ANDROID) | |
| 25 net::NetworkChangeNotifier::ConnectionType type = | |
| 26 net::NetworkChangeNotifier::GetConnectionType(); | |
| 27 unsigned mcc_mnc = 0; | |
| 28 if (type == net::NetworkChangeNotifier::CONNECTION_2G || | |
| 29 type == net::NetworkChangeNotifier::CONNECTION_3G || | |
| 30 type == net::NetworkChangeNotifier::CONNECTION_4G) { | |
| 31 // Log zero if not perfectly converted. | |
| 32 if (!base::StringToUint( | |
| 33 net::android::GetTelephonyNetworkOperator(), &mcc_mnc)) { | |
| 34 mcc_mnc = 0; | |
| 35 } | |
| 36 } | |
| 37 UMA_HISTOGRAM_SPARSE_SLOWLY("NCN.NetworkOperatorMCCMNC", mcc_mnc); | |
|
Ilya Sherman
2014/05/08 03:48:40
Can you share lines 27-37 with the equivalent code
bolian
2014/05/08 06:38:24
Done.
| |
| 38 #endif | |
| 39 } | |
| OLD | NEW |