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

Side by Side Diff: net/base/network_change_notifier.cc

Issue 246553003: Record Mobile Operator ID in UMA report. This is Android only for now. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@operator_id
Patch Set: addressed comments. 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
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 #include "net/base/network_change_notifier.h" 5 #include "net/base/network_change_notifier.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/metrics/sparse_histogram.h"
8 #include "base/synchronization/lock.h" 9 #include "base/synchronization/lock.h"
9 #include "base/threading/thread_checker.h" 10 #include "base/threading/thread_checker.h"
10 #include "build/build_config.h" 11 #include "build/build_config.h"
11 #include "net/base/net_util.h" 12 #include "net/base/net_util.h"
12 #include "net/base/network_change_notifier_factory.h" 13 #include "net/base/network_change_notifier_factory.h"
13 #include "net/dns/dns_config_service.h" 14 #include "net/dns/dns_config_service.h"
14 #include "net/url_request/url_request.h" 15 #include "net/url_request/url_request.h"
15 #include "url/gurl.h" 16 #include "url/gurl.h"
16 17
18 #if defined(OS_ANDROID)
19 #include "net/android/network_library.h"
20 #endif
21
17 #if defined(OS_WIN) 22 #if defined(OS_WIN)
18 #include "net/base/network_change_notifier_win.h" 23 #include "net/base/network_change_notifier_win.h"
19 #elif defined(OS_LINUX) && !defined(OS_CHROMEOS) 24 #elif defined(OS_LINUX) && !defined(OS_CHROMEOS)
20 #include "net/base/network_change_notifier_linux.h" 25 #include "net/base/network_change_notifier_linux.h"
21 #elif defined(OS_MACOSX) 26 #elif defined(OS_MACOSX)
22 #include "net/base/network_change_notifier_mac.h" 27 #include "net/base/network_change_notifier_mac.h"
23 #endif 28 #endif
24 29
25 namespace net { 30 namespace net {
26 31
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 SinceLast(&last_dns_change_)); 251 SinceLast(&last_dns_change_));
247 } 252 }
248 253
249 // NetworkChangeNotifier::NetworkChangeObserver implementation. 254 // NetworkChangeNotifier::NetworkChangeObserver implementation.
250 virtual void OnNetworkChanged( 255 virtual void OnNetworkChanged(
251 NetworkChangeNotifier::ConnectionType type) OVERRIDE { 256 NetworkChangeNotifier::ConnectionType type) OVERRIDE {
252 DCHECK(thread_checker_.CalledOnValidThread()); 257 DCHECK(thread_checker_.CalledOnValidThread());
253 if (type != NetworkChangeNotifier::CONNECTION_NONE) { 258 if (type != NetworkChangeNotifier::CONNECTION_NONE) {
254 UMA_HISTOGRAM_MEDIUM_TIMES("NCN.NetworkOnlineChange", 259 UMA_HISTOGRAM_MEDIUM_TIMES("NCN.NetworkOnlineChange",
255 SinceLast(&last_network_change_)); 260 SinceLast(&last_network_change_));
261 #if defined(OS_ANDROID)
262 std::string mcc_mnc = android::GetTelephonyNetworkOperator();
263 if (!mcc_mnc.empty()) {
264 int value = atoi(mcc_mnc.c_str());
265 if (value > 0) {
266 UMA_HISTOGRAM_SPARSE_SLOWLY("NCN.NetworkOperatorMCCMNC", value);
267 }
268 }
269 #endif
270
256 } else { 271 } else {
257 UMA_HISTOGRAM_MEDIUM_TIMES("NCN.NetworkOfflineChange", 272 UMA_HISTOGRAM_MEDIUM_TIMES("NCN.NetworkOfflineChange",
258 SinceLast(&last_network_change_)); 273 SinceLast(&last_network_change_));
259 } 274 }
260 } 275 }
261 276
262 // Record histogram data whenever we receive a packet. Should only be called 277 // Record histogram data whenever we receive a packet. Should only be called
263 // from the network thread. 278 // from the network thread.
264 void NotifyDataReceived(const URLRequest& request, int bytes_read) { 279 void NotifyDataReceived(const URLRequest& request, int bytes_read) {
265 DCHECK(thread_checker_.CalledOnValidThread()); 280 DCHECK(thread_checker_.CalledOnValidThread());
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 DCHECK(g_network_change_notifier); 757 DCHECK(g_network_change_notifier);
743 g_network_change_notifier = NULL; 758 g_network_change_notifier = NULL;
744 } 759 }
745 760
746 NetworkChangeNotifier::DisableForTest::~DisableForTest() { 761 NetworkChangeNotifier::DisableForTest::~DisableForTest() {
747 DCHECK(!g_network_change_notifier); 762 DCHECK(!g_network_change_notifier);
748 g_network_change_notifier = network_change_notifier_; 763 g_network_change_notifier = network_change_notifier_;
749 } 764 }
750 765
751 } // namespace net 766 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | tools/metrics/histograms/histograms.xml » ('J')

Powered by Google App Engine
This is Rietveld 408576698