| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 TimeDelta transport_rtt, | 165 TimeDelta transport_rtt, |
| 166 int downlink_throughput_kbps); | 166 int downlink_throughput_kbps); |
| 167 | 167 |
| 168 // When called, successive setWebConnectionType/setOnLine calls are stored, | 168 // When called, successive setWebConnectionType/setOnLine calls are stored, |
| 169 // and supplied overridden values are used instead until clearOverride() is | 169 // and supplied overridden values are used instead until clearOverride() is |
| 170 // called. This is used for layout tests (see crbug.com/377736) and inspector | 170 // called. This is used for layout tests (see crbug.com/377736) and inspector |
| 171 // emulation. | 171 // emulation. |
| 172 // | 172 // |
| 173 // Since this class is a singleton, tests must clear override when completed | 173 // Since this class is a singleton, tests must clear override when completed |
| 174 // to avoid indeterminate state across the test harness. | 174 // to avoid indeterminate state across the test harness. |
| 175 void SetOverride(bool on_line, WebConnectionType, double max_bandwidth_mbps); | 175 void SetNetworkConnectionInfoOverride(bool on_line, |
| 176 WebConnectionType, |
| 177 double max_bandwidth_mbps); |
| 178 void SetNetworkQualityInfoOverride(WebEffectiveConnectionType effective_type, |
| 179 unsigned long transport_rtt_msec, |
| 180 double downlink_throughput_mbps); |
| 176 void ClearOverride(); | 181 void ClearOverride(); |
| 177 | 182 |
| 178 // Must be called on the given task runner. An added observer must be removed | 183 // Must be called on the given task runner. An added observer must be removed |
| 179 // before the observer or its execution context goes away. It's possible for | 184 // before the observer or its execution context goes away. It's possible for |
| 180 // an observer to be called twice for the same event if it is first removed | 185 // an observer to be called twice for the same event if it is first removed |
| 181 // and then added during notification. | 186 // and then added during notification. |
| 182 void AddConnectionObserver(NetworkStateObserver*, PassRefPtr<WebTaskRunner>); | 187 void AddConnectionObserver(NetworkStateObserver*, PassRefPtr<WebTaskRunner>); |
| 183 void AddOnLineObserver(NetworkStateObserver*, PassRefPtr<WebTaskRunner>); | 188 void AddOnLineObserver(NetworkStateObserver*, PassRefPtr<WebTaskRunner>); |
| 184 void RemoveConnectionObserver(NetworkStateObserver*, | 189 void RemoveConnectionObserver(NetworkStateObserver*, |
| 185 PassRefPtr<WebTaskRunner>); | 190 PassRefPtr<WebTaskRunner>); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 | 252 |
| 248 ObserverListMap connection_observers_; | 253 ObserverListMap connection_observers_; |
| 249 ObserverListMap on_line_state_observers_; | 254 ObserverListMap on_line_state_observers_; |
| 250 }; | 255 }; |
| 251 | 256 |
| 252 PLATFORM_EXPORT NetworkStateNotifier& GetNetworkStateNotifier(); | 257 PLATFORM_EXPORT NetworkStateNotifier& GetNetworkStateNotifier(); |
| 253 | 258 |
| 254 } // namespace blink | 259 } // namespace blink |
| 255 | 260 |
| 256 #endif // NetworkStateNotifier_h | 261 #endif // NetworkStateNotifier_h |
| OLD | NEW |