| 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 "base/threading/thread_checker.h" | 9 #include "base/threading/thread_checker.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 // static | 500 // static |
| 501 NetworkChangeNotifier* NetworkChangeNotifier::Create() { | 501 NetworkChangeNotifier* NetworkChangeNotifier::Create() { |
| 502 if (g_network_change_notifier_factory) | 502 if (g_network_change_notifier_factory) |
| 503 return g_network_change_notifier_factory->CreateInstance(); | 503 return g_network_change_notifier_factory->CreateInstance(); |
| 504 | 504 |
| 505 #if defined(OS_WIN) | 505 #if defined(OS_WIN) |
| 506 NetworkChangeNotifierWin* network_change_notifier = | 506 NetworkChangeNotifierWin* network_change_notifier = |
| 507 new NetworkChangeNotifierWin(); | 507 new NetworkChangeNotifierWin(); |
| 508 network_change_notifier->WatchForAddressChange(); | 508 network_change_notifier->WatchForAddressChange(); |
| 509 return network_change_notifier; | 509 return network_change_notifier; |
| 510 #elif defined(OS_CHROMEOS) || defined(OS_ANDROID) | 510 #elif defined(USE_NETWORK_CHANGE_NOTIFIER_FACTORY) |
| 511 // ChromeOS and Android builds MUST use their own class factory. | 511 // Check that we never reach here for platforms/products that use their |
| 512 // own class factory. |
| 512 #if !defined(OS_CHROMEOS) | 513 #if !defined(OS_CHROMEOS) |
| 513 // TODO(oshima): ash_shell do not have access to chromeos'es | 514 // TODO(oshima): ash_shell do not have access to chromeos'es |
| 514 // notifier yet. Re-enable this when chromeos'es notifier moved to | 515 // notifier yet. Re-enable this when chromeos'es notifier moved to |
| 515 // chromeos root directory. crbug.com/119298. | 516 // chromeos root directory. crbug.com/119298. |
| 516 CHECK(false); | 517 CHECK(false); |
| 517 #endif | 518 #endif |
| 518 return NULL; | 519 return NULL; |
| 519 #elif defined(OS_LINUX) | 520 #elif defined(OS_LINUX) |
| 520 return NetworkChangeNotifierLinux::Create(); | 521 return NetworkChangeNotifierLinux::Create(); |
| 521 #elif defined(OS_MACOSX) | 522 #elif defined(OS_MACOSX) |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 DCHECK(g_network_change_notifier); | 857 DCHECK(g_network_change_notifier); |
| 857 g_network_change_notifier = NULL; | 858 g_network_change_notifier = NULL; |
| 858 } | 859 } |
| 859 | 860 |
| 860 NetworkChangeNotifier::DisableForTest::~DisableForTest() { | 861 NetworkChangeNotifier::DisableForTest::~DisableForTest() { |
| 861 DCHECK(!g_network_change_notifier); | 862 DCHECK(!g_network_change_notifier); |
| 862 g_network_change_notifier = network_change_notifier_; | 863 g_network_change_notifier = network_change_notifier_; |
| 863 } | 864 } |
| 864 | 865 |
| 865 } // namespace net | 866 } // namespace net |
| OLD | NEW |