OLD | NEW |
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 #include "net/base/network_change_notifier_factory.h" | 6 #include "net/base/network_change_notifier_factory.h" |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "googleurl/src/gurl.h" | 9 #include "googleurl/src/gurl.h" |
10 #include "net/base/net_util.h" | 10 #include "net/base/net_util.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 // in ways that would require us to place locks around access to this object. | 24 // in ways that would require us to place locks around access to this object. |
25 // (The prohibition on global non-POD objects makes it tricky to do such a thing | 25 // (The prohibition on global non-POD objects makes it tricky to do such a thing |
26 // anyway.) | 26 // anyway.) |
27 NetworkChangeNotifier* g_network_change_notifier = NULL; | 27 NetworkChangeNotifier* g_network_change_notifier = NULL; |
28 | 28 |
29 // Class factory singleton. | 29 // Class factory singleton. |
30 NetworkChangeNotifierFactory* g_network_change_notifier_factory = NULL; | 30 NetworkChangeNotifierFactory* g_network_change_notifier_factory = NULL; |
31 | 31 |
32 class MockNetworkChangeNotifier : public NetworkChangeNotifier { | 32 class MockNetworkChangeNotifier : public NetworkChangeNotifier { |
33 public: | 33 public: |
34 virtual ConnectionType GetCurrentConnectionType() const { | 34 virtual ConnectionType GetCurrentConnectionType() const OVERRIDE { |
35 return CONNECTION_UNKNOWN; | 35 return CONNECTION_UNKNOWN; |
36 } | 36 } |
37 }; | 37 }; |
38 | 38 |
39 } // namespace | 39 } // namespace |
40 | 40 |
41 // The main observer class that records UMAs for network events. | 41 // The main observer class that records UMAs for network events. |
42 class HistogramWatcher | 42 class HistogramWatcher |
43 : public NetworkChangeNotifier::ConnectionTypeObserver, | 43 : public NetworkChangeNotifier::ConnectionTypeObserver, |
44 public NetworkChangeNotifier::IPAddressObserver, | 44 public NetworkChangeNotifier::IPAddressObserver, |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 DCHECK(g_network_change_notifier); | 334 DCHECK(g_network_change_notifier); |
335 g_network_change_notifier = NULL; | 335 g_network_change_notifier = NULL; |
336 } | 336 } |
337 | 337 |
338 NetworkChangeNotifier::DisableForTest::~DisableForTest() { | 338 NetworkChangeNotifier::DisableForTest::~DisableForTest() { |
339 DCHECK(!g_network_change_notifier); | 339 DCHECK(!g_network_change_notifier); |
340 g_network_change_notifier = network_change_notifier_; | 340 g_network_change_notifier = network_change_notifier_; |
341 } | 341 } |
342 | 342 |
343 } // namespace net | 343 } // namespace net |
OLD | NEW |