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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 case net::NetworkChangeNotifier::CONNECTION_BLUETOOTH: | 64 case net::NetworkChangeNotifier::CONNECTION_BLUETOOTH: |
65 return "CONNECTION_BLUETOOTH"; | 65 return "CONNECTION_BLUETOOTH"; |
66 default: | 66 default: |
67 return "CONNECTION_UNEXPECTED"; | 67 return "CONNECTION_UNEXPECTED"; |
68 } | 68 } |
69 } | 69 } |
70 | 70 |
71 std::string ProxyConfigToString(const net::ProxyConfig& config) { | 71 std::string ProxyConfigToString(const net::ProxyConfig& config) { |
72 scoped_ptr<base::Value> config_value(config.ToValue()); | 72 scoped_ptr<base::Value> config_value(config.ToValue()); |
73 std::string str; | 73 std::string str; |
74 base::JSONWriter::Write(config_value.get(), &str); | 74 base::JSONWriter::Write(*config_value, &str); |
75 return str; | 75 return str; |
76 } | 76 } |
77 | 77 |
78 const char* ConfigAvailabilityToString( | 78 const char* ConfigAvailabilityToString( |
79 net::ProxyConfigService::ConfigAvailability availability) { | 79 net::ProxyConfigService::ConfigAvailability availability) { |
80 switch (availability) { | 80 switch (availability) { |
81 case net::ProxyConfigService::CONFIG_PENDING: | 81 case net::ProxyConfigService::CONFIG_PENDING: |
82 return "CONFIG_PENDING"; | 82 return "CONFIG_PENDING"; |
83 case net::ProxyConfigService::CONFIG_VALID: | 83 case net::ProxyConfigService::CONFIG_VALID: |
84 return "CONFIG_VALID"; | 84 return "CONFIG_VALID"; |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 proxy_config_service->RemoveObserver(&net_watcher); | 219 proxy_config_service->RemoveObserver(&net_watcher); |
220 | 220 |
221 // Uses |network_change_notifier|. | 221 // Uses |network_change_notifier|. |
222 net::NetworkChangeNotifier::RemoveDNSObserver(&net_watcher); | 222 net::NetworkChangeNotifier::RemoveDNSObserver(&net_watcher); |
223 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(&net_watcher); | 223 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(&net_watcher); |
224 net::NetworkChangeNotifier::RemoveIPAddressObserver(&net_watcher); | 224 net::NetworkChangeNotifier::RemoveIPAddressObserver(&net_watcher); |
225 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(&net_watcher); | 225 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(&net_watcher); |
226 | 226 |
227 return 0; | 227 return 0; |
228 } | 228 } |
OLD | NEW |