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

Side by Side Diff: chrome/browser/chrome_browser_metrics_service_observer.cc

Issue 253203002: Log operator code histogram on new metric log (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@api_move
Patch Set: combine and rename metric name. Created 6 years, 7 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
(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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698