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 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/synchronization/lock.h" | 8 #include "base/synchronization/lock.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 | 217 |
218 NetworkChangeNotifier::NetworkChangeCalculatorParams:: | 218 NetworkChangeNotifier::NetworkChangeCalculatorParams:: |
219 NetworkChangeCalculatorParams() { | 219 NetworkChangeCalculatorParams() { |
220 } | 220 } |
221 | 221 |
222 // Calculates NetworkChange signal from IPAddress and ConnectionType signals. | 222 // Calculates NetworkChange signal from IPAddress and ConnectionType signals. |
223 class NetworkChangeNotifier::NetworkChangeCalculator | 223 class NetworkChangeNotifier::NetworkChangeCalculator |
224 : public ConnectionTypeObserver, | 224 : public ConnectionTypeObserver, |
225 public IPAddressObserver { | 225 public IPAddressObserver { |
226 public: | 226 public: |
227 NetworkChangeCalculator(const NetworkChangeCalculatorParams& params) | 227 explicit NetworkChangeCalculator(const NetworkChangeCalculatorParams& params) |
228 : params_(params), | 228 : params_(params), |
229 have_announced_(false), | 229 have_announced_(false), |
230 last_announced_connection_type_(CONNECTION_NONE), | 230 last_announced_connection_type_(CONNECTION_NONE), |
231 pending_connection_type_(CONNECTION_NONE) {} | 231 pending_connection_type_(CONNECTION_NONE) {} |
232 | 232 |
233 void Init() { | 233 void Init() { |
234 AddConnectionTypeObserver(this); | 234 AddConnectionTypeObserver(this); |
235 AddIPAddressObserver(this); | 235 AddIPAddressObserver(this); |
236 } | 236 } |
237 | 237 |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 DCHECK(g_network_change_notifier); | 556 DCHECK(g_network_change_notifier); |
557 g_network_change_notifier = NULL; | 557 g_network_change_notifier = NULL; |
558 } | 558 } |
559 | 559 |
560 NetworkChangeNotifier::DisableForTest::~DisableForTest() { | 560 NetworkChangeNotifier::DisableForTest::~DisableForTest() { |
561 DCHECK(!g_network_change_notifier); | 561 DCHECK(!g_network_change_notifier); |
562 g_network_change_notifier = network_change_notifier_; | 562 g_network_change_notifier = network_change_notifier_; |
563 } | 563 } |
564 | 564 |
565 } // namespace net | 565 } // namespace net |
OLD | NEW |