| 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 // This is a small utility that watches for and logs network changes. | 5 // This is a small utility that watches for and logs network changes. |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 G_GNUC_BEGIN_IGNORE_DEPRECATIONS | 146 G_GNUC_BEGIN_IGNORE_DEPRECATIONS |
| 147 #endif | 147 #endif |
| 148 g_type_init(); | 148 g_type_init(); |
| 149 #if defined(USE_GLIB_DEPRECATIONS_MACROS) | 149 #if defined(USE_GLIB_DEPRECATIONS_MACROS) |
| 150 G_GNUC_END_IGNORE_DEPRECATIONS | 150 G_GNUC_END_IGNORE_DEPRECATIONS |
| 151 #endif | 151 #endif |
| 152 #undef USE_GLIB_DEPRECATIONS_MACROS | 152 #undef USE_GLIB_DEPRECATIONS_MACROS |
| 153 #endif // (defined(OS_LINUX) || defined(OS_OPENBSD)) && !defined(OS_CHROMEOS) | 153 #endif // (defined(OS_LINUX) || defined(OS_OPENBSD)) && !defined(OS_CHROMEOS) |
| 154 base::AtExitManager exit_manager; | 154 base::AtExitManager exit_manager; |
| 155 CommandLine::Init(argc, argv); | 155 CommandLine::Init(argc, argv); |
| 156 logging::InitLogging( | 156 logging::LoggingSettings settings; |
| 157 NULL, | 157 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
| 158 logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, | 158 logging::InitLogging(settings); |
| 159 logging::LOCK_LOG_FILE, | |
| 160 logging::DELETE_OLD_LOG_FILE, | |
| 161 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); | |
| 162 | 159 |
| 163 // Just make the main message loop the network loop. | 160 // Just make the main message loop the network loop. |
| 164 base::MessageLoopForIO network_loop; | 161 base::MessageLoopForIO network_loop; |
| 165 | 162 |
| 166 NetWatcher net_watcher; | 163 NetWatcher net_watcher; |
| 167 | 164 |
| 168 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier( | 165 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier( |
| 169 net::NetworkChangeNotifier::Create()); | 166 net::NetworkChangeNotifier::Create()); |
| 170 | 167 |
| 171 // Use the network loop as the file loop also. | 168 // Use the network loop as the file loop also. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 202 proxy_config_service->RemoveObserver(&net_watcher); | 199 proxy_config_service->RemoveObserver(&net_watcher); |
| 203 | 200 |
| 204 // Uses |network_change_notifier|. | 201 // Uses |network_change_notifier|. |
| 205 net::NetworkChangeNotifier::RemoveDNSObserver(&net_watcher); | 202 net::NetworkChangeNotifier::RemoveDNSObserver(&net_watcher); |
| 206 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(&net_watcher); | 203 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(&net_watcher); |
| 207 net::NetworkChangeNotifier::RemoveIPAddressObserver(&net_watcher); | 204 net::NetworkChangeNotifier::RemoveIPAddressObserver(&net_watcher); |
| 208 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(&net_watcher); | 205 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(&net_watcher); |
| 209 | 206 |
| 210 return 0; | 207 return 0; |
| 211 } | 208 } |
| OLD | NEW |