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 // It prints out the current network connection type and proxy configuration |
| 7 // upon startup and then prints out changes as they happen. |
| 8 // It's useful for testing NetworkChangeNotifier and ProxyConfigService. |
| 9 // The only command line option supported is --ignore-netif which is followed |
| 10 // by a comma seperated list of network interfaces to ignore when computing |
| 11 // connection type; this option is only supported on linux. |
6 | 12 |
7 #include <memory> | 13 #include <memory> |
8 #include <string> | 14 #include <string> |
9 #include <unordered_set> | 15 #include <unordered_set> |
10 | 16 |
11 #include "base/at_exit.h" | 17 #include "base/at_exit.h" |
12 #include "base/command_line.h" | 18 #include "base/command_line.h" |
13 #include "base/compiler_specific.h" | 19 #include "base/compiler_specific.h" |
14 #include "base/json/json_writer.h" | 20 #include "base/json/json_writer.h" |
15 #include "base/logging.h" | 21 #include "base/logging.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 proxy_config_service->RemoveObserver(&net_watcher); | 225 proxy_config_service->RemoveObserver(&net_watcher); |
220 | 226 |
221 // Uses |network_change_notifier|. | 227 // Uses |network_change_notifier|. |
222 net::NetworkChangeNotifier::RemoveDNSObserver(&net_watcher); | 228 net::NetworkChangeNotifier::RemoveDNSObserver(&net_watcher); |
223 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(&net_watcher); | 229 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(&net_watcher); |
224 net::NetworkChangeNotifier::RemoveIPAddressObserver(&net_watcher); | 230 net::NetworkChangeNotifier::RemoveIPAddressObserver(&net_watcher); |
225 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(&net_watcher); | 231 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(&net_watcher); |
226 | 232 |
227 return 0; | 233 return 0; |
228 } | 234 } |
OLD | NEW |