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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 case net::NetworkChangeNotifier::CONNECTION_WIFI: | 43 case net::NetworkChangeNotifier::CONNECTION_WIFI: |
44 return "CONNECTION_WIFI"; | 44 return "CONNECTION_WIFI"; |
45 case net::NetworkChangeNotifier::CONNECTION_2G: | 45 case net::NetworkChangeNotifier::CONNECTION_2G: |
46 return "CONNECTION_2G"; | 46 return "CONNECTION_2G"; |
47 case net::NetworkChangeNotifier::CONNECTION_3G: | 47 case net::NetworkChangeNotifier::CONNECTION_3G: |
48 return "CONNECTION_3G"; | 48 return "CONNECTION_3G"; |
49 case net::NetworkChangeNotifier::CONNECTION_4G: | 49 case net::NetworkChangeNotifier::CONNECTION_4G: |
50 return "CONNECTION_4G"; | 50 return "CONNECTION_4G"; |
51 case net::NetworkChangeNotifier::CONNECTION_NONE: | 51 case net::NetworkChangeNotifier::CONNECTION_NONE: |
52 return "CONNECTION_NONE"; | 52 return "CONNECTION_NONE"; |
53 default: | 53 case net::NetworkChangeNotifier::CONNECTION_BLUETOOTH: |
54 return "CONNECTION_UNEXPECTED"; | 54 return "CONNECTION_BLUETOOTH"; |
55 } | 55 } |
56 } | 56 } |
57 | 57 |
58 std::string ProxyConfigToString(const net::ProxyConfig& config) { | 58 std::string ProxyConfigToString(const net::ProxyConfig& config) { |
59 scoped_ptr<base::Value> config_value(config.ToValue()); | 59 scoped_ptr<base::Value> config_value(config.ToValue()); |
60 std::string str; | 60 std::string str; |
61 base::JSONWriter::Write(config_value.get(), &str); | 61 base::JSONWriter::Write(config_value.get(), &str); |
62 return str; | 62 return str; |
63 } | 63 } |
64 | 64 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 proxy_config_service->RemoveObserver(&net_watcher); | 189 proxy_config_service->RemoveObserver(&net_watcher); |
190 | 190 |
191 // Uses |network_change_notifier|. | 191 // Uses |network_change_notifier|. |
192 net::NetworkChangeNotifier::RemoveDNSObserver(&net_watcher); | 192 net::NetworkChangeNotifier::RemoveDNSObserver(&net_watcher); |
193 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(&net_watcher); | 193 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(&net_watcher); |
194 net::NetworkChangeNotifier::RemoveIPAddressObserver(&net_watcher); | 194 net::NetworkChangeNotifier::RemoveIPAddressObserver(&net_watcher); |
195 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(&net_watcher); | 195 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(&net_watcher); |
196 | 196 |
197 return 0; | 197 return 0; |
198 } | 198 } |
OLD | NEW |