| 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 #ifndef NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ | 5 #ifndef NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ |
| 6 #define NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ | 6 #define NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/observer_list_threadsafe.h" | 9 #include "base/observer_list_threadsafe.h" |
| 10 #include "net/base/net_export.h" | 10 #include "net/base/net_export.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 // there's no reason to use the API in this risky way, so don't do it. | 156 // there's no reason to use the API in this risky way, so don't do it. |
| 157 static void RemoveIPAddressObserver(IPAddressObserver* observer); | 157 static void RemoveIPAddressObserver(IPAddressObserver* observer); |
| 158 static void RemoveConnectionTypeObserver(ConnectionTypeObserver* observer); | 158 static void RemoveConnectionTypeObserver(ConnectionTypeObserver* observer); |
| 159 static void RemoveDNSObserver(DNSObserver* observer); | 159 static void RemoveDNSObserver(DNSObserver* observer); |
| 160 | 160 |
| 161 // Allow unit tests to trigger notifications. | 161 // Allow unit tests to trigger notifications. |
| 162 static void NotifyObserversOfIPAddressChangeForTests() { | 162 static void NotifyObserversOfIPAddressChangeForTests() { |
| 163 NotifyObserversOfIPAddressChange(); | 163 NotifyObserversOfIPAddressChange(); |
| 164 } | 164 } |
| 165 | 165 |
| 166 // Return a string equivalent to |type|. |
| 167 static const char* ConnectionTypeToString(ConnectionType type); |
| 168 |
| 166 // Let the NetworkChangeNotifier know we received some data. | 169 // Let the NetworkChangeNotifier know we received some data. |
| 167 // This is used strictly for producing histogram data about the accuracy of | 170 // This is used strictly for producing histogram data about the accuracy of |
| 168 // the NetworkChangenotifier's online detection. | 171 // the NetworkChangenotifier's online detection. |
| 169 static void NotifyDataReceived(const GURL& source); | 172 static void NotifyDataReceived(const GURL& source); |
| 170 | 173 |
| 171 // Register the Observer callbacks for producing histogram data. This | 174 // Register the Observer callbacks for producing histogram data. This |
| 172 // should be called from the network thread to avoid race conditions. | 175 // should be called from the network thread to avoid race conditions. |
| 173 static void InitHistogramWatcher(); | 176 static void InitHistogramWatcher(); |
| 174 | 177 |
| 175 protected: | 178 protected: |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 | 232 |
| 230 // A little-piggy-back observer that simply logs UMA histogram data. | 233 // A little-piggy-back observer that simply logs UMA histogram data. |
| 231 scoped_ptr<HistogramWatcher> histogram_watcher_; | 234 scoped_ptr<HistogramWatcher> histogram_watcher_; |
| 232 | 235 |
| 233 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier); | 236 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier); |
| 234 }; | 237 }; |
| 235 | 238 |
| 236 } // namespace net | 239 } // namespace net |
| 237 | 240 |
| 238 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ | 241 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ |
| OLD | NEW |