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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 public net::NetworkChangeNotifier::ConnectionTypeObserver, | 84 public net::NetworkChangeNotifier::ConnectionTypeObserver, |
85 public net::NetworkChangeNotifier::DNSObserver, | 85 public net::NetworkChangeNotifier::DNSObserver, |
86 public net::NetworkChangeNotifier::NetworkChangeObserver, | 86 public net::NetworkChangeNotifier::NetworkChangeObserver, |
87 public net::ProxyConfigService::Observer { | 87 public net::ProxyConfigService::Observer { |
88 public: | 88 public: |
89 NetWatcher() {} | 89 NetWatcher() {} |
90 | 90 |
91 virtual ~NetWatcher() {} | 91 virtual ~NetWatcher() {} |
92 | 92 |
93 // net::NetworkChangeNotifier::IPAddressObserver implementation. | 93 // net::NetworkChangeNotifier::IPAddressObserver implementation. |
94 virtual void OnIPAddressChanged() OVERRIDE { | 94 virtual void OnIPAddressChanged() override { |
95 LOG(INFO) << "OnIPAddressChanged()"; | 95 LOG(INFO) << "OnIPAddressChanged()"; |
96 } | 96 } |
97 | 97 |
98 // net::NetworkChangeNotifier::ConnectionTypeObserver implementation. | 98 // net::NetworkChangeNotifier::ConnectionTypeObserver implementation. |
99 virtual void OnConnectionTypeChanged( | 99 virtual void OnConnectionTypeChanged( |
100 net::NetworkChangeNotifier::ConnectionType type) OVERRIDE { | 100 net::NetworkChangeNotifier::ConnectionType type) override { |
101 LOG(INFO) << "OnConnectionTypeChanged(" | 101 LOG(INFO) << "OnConnectionTypeChanged(" |
102 << ConnectionTypeToString(type) << ")"; | 102 << ConnectionTypeToString(type) << ")"; |
103 } | 103 } |
104 | 104 |
105 // net::NetworkChangeNotifier::DNSObserver implementation. | 105 // net::NetworkChangeNotifier::DNSObserver implementation. |
106 virtual void OnDNSChanged() OVERRIDE { | 106 virtual void OnDNSChanged() override { |
107 LOG(INFO) << "OnDNSChanged()"; | 107 LOG(INFO) << "OnDNSChanged()"; |
108 } | 108 } |
109 | 109 |
110 // net::NetworkChangeNotifier::NetworkChangeObserver implementation. | 110 // net::NetworkChangeNotifier::NetworkChangeObserver implementation. |
111 virtual void OnNetworkChanged( | 111 virtual void OnNetworkChanged( |
112 net::NetworkChangeNotifier::ConnectionType type) OVERRIDE { | 112 net::NetworkChangeNotifier::ConnectionType type) override { |
113 LOG(INFO) << "OnNetworkChanged(" | 113 LOG(INFO) << "OnNetworkChanged(" |
114 << ConnectionTypeToString(type) << ")"; | 114 << ConnectionTypeToString(type) << ")"; |
115 } | 115 } |
116 | 116 |
117 // net::ProxyConfigService::Observer implementation. | 117 // net::ProxyConfigService::Observer implementation. |
118 virtual void OnProxyConfigChanged( | 118 virtual void OnProxyConfigChanged( |
119 const net::ProxyConfig& config, | 119 const net::ProxyConfig& config, |
120 net::ProxyConfigService::ConfigAvailability availability) OVERRIDE { | 120 net::ProxyConfigService::ConfigAvailability availability) override { |
121 LOG(INFO) << "OnProxyConfigChanged(" | 121 LOG(INFO) << "OnProxyConfigChanged(" |
122 << ProxyConfigToString(config) << ", " | 122 << ProxyConfigToString(config) << ", " |
123 << ConfigAvailabilityToString(availability) << ")"; | 123 << ConfigAvailabilityToString(availability) << ")"; |
124 } | 124 } |
125 | 125 |
126 private: | 126 private: |
127 DISALLOW_COPY_AND_ASSIGN(NetWatcher); | 127 DISALLOW_COPY_AND_ASSIGN(NetWatcher); |
128 }; | 128 }; |
129 | 129 |
130 } // namespace | 130 } // namespace |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 proxy_config_service->RemoveObserver(&net_watcher); | 192 proxy_config_service->RemoveObserver(&net_watcher); |
193 | 193 |
194 // Uses |network_change_notifier|. | 194 // Uses |network_change_notifier|. |
195 net::NetworkChangeNotifier::RemoveDNSObserver(&net_watcher); | 195 net::NetworkChangeNotifier::RemoveDNSObserver(&net_watcher); |
196 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(&net_watcher); | 196 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(&net_watcher); |
197 net::NetworkChangeNotifier::RemoveIPAddressObserver(&net_watcher); | 197 net::NetworkChangeNotifier::RemoveIPAddressObserver(&net_watcher); |
198 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(&net_watcher); | 198 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(&net_watcher); |
199 | 199 |
200 return 0; | 200 return 0; |
201 } | 201 } |
OLD | NEW |