| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2013 Apple Inc. All rights reserved. | 3 * Copyright (C) 2013 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 3070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3081 } else if (type == "none") { | 3081 } else if (type == "none") { |
| 3082 webtype = kWebConnectionTypeNone; | 3082 webtype = kWebConnectionTypeNone; |
| 3083 } else if (type == "unknown") { | 3083 } else if (type == "unknown") { |
| 3084 webtype = kWebConnectionTypeUnknown; | 3084 webtype = kWebConnectionTypeUnknown; |
| 3085 } else { | 3085 } else { |
| 3086 exception_state.ThrowDOMException( | 3086 exception_state.ThrowDOMException( |
| 3087 kNotFoundError, | 3087 kNotFoundError, |
| 3088 ExceptionMessages::FailedToEnumerate("connection type", type)); | 3088 ExceptionMessages::FailedToEnumerate("connection type", type)); |
| 3089 return; | 3089 return; |
| 3090 } | 3090 } |
| 3091 GetNetworkStateNotifier().SetOverride(on_line, webtype, downlink_max_mbps); | 3091 GetNetworkStateNotifier().SetNetworkConnectionInfoOverride(on_line, webtype, |
| 3092 downlink_max_mbps); |
| 3093 } |
| 3094 |
| 3095 void Internals::setNetworkQualityInfoOverride(const String& effective_type, |
| 3096 unsigned long transport_rtt_msec, |
| 3097 double downlink_throughput_mbps, |
| 3098 ExceptionState& exception_state) { |
| 3099 WebEffectiveConnectionType web_effective_type = |
| 3100 WebEffectiveConnectionType::kTypeUnknown; |
| 3101 if (effective_type == "offline") { |
| 3102 web_effective_type = WebEffectiveConnectionType::kTypeOffline; |
| 3103 } else if (effective_type == "slow-2g") { |
| 3104 web_effective_type = WebEffectiveConnectionType::kTypeSlow2G; |
| 3105 } else if (effective_type == "2g") { |
| 3106 web_effective_type = WebEffectiveConnectionType::kType2G; |
| 3107 } else if (effective_type == "3g") { |
| 3108 web_effective_type = WebEffectiveConnectionType::kType3G; |
| 3109 } else if (effective_type == "4g") { |
| 3110 web_effective_type = WebEffectiveConnectionType::kType4G; |
| 3111 } else if (effective_type != "unknown") { |
| 3112 exception_state.ThrowDOMException( |
| 3113 kNotFoundError, ExceptionMessages::FailedToEnumerate( |
| 3114 "effective connection type", effective_type)); |
| 3115 return; |
| 3116 } |
| 3117 |
| 3118 GetNetworkStateNotifier().SetNetworkQualityInfoOverride( |
| 3119 web_effective_type, transport_rtt_msec, downlink_throughput_mbps); |
| 3092 } | 3120 } |
| 3093 | 3121 |
| 3094 void Internals::clearNetworkConnectionInfoOverride() { | 3122 void Internals::clearNetworkConnectionInfoOverride() { |
| 3095 GetNetworkStateNotifier().ClearOverride(); | 3123 GetNetworkStateNotifier().ClearOverride(); |
| 3096 } | 3124 } |
| 3097 | 3125 |
| 3098 unsigned Internals::countHitRegions(CanvasRenderingContext* context) { | 3126 unsigned Internals::countHitRegions(CanvasRenderingContext* context) { |
| 3099 return context->HitRegionsCount(); | 3127 return context->HitRegionsCount(); |
| 3100 } | 3128 } |
| 3101 | 3129 |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3293 | 3321 |
| 3294 void Internals::crash() { | 3322 void Internals::crash() { |
| 3295 CHECK(false) << "Intentional crash"; | 3323 CHECK(false) << "Intentional crash"; |
| 3296 } | 3324 } |
| 3297 | 3325 |
| 3298 void Internals::setIsLowEndDevice(bool is_low_end_device) { | 3326 void Internals::setIsLowEndDevice(bool is_low_end_device) { |
| 3299 MemoryCoordinator::SetIsLowEndDeviceForTesting(is_low_end_device); | 3327 MemoryCoordinator::SetIsLowEndDeviceForTesting(is_low_end_device); |
| 3300 } | 3328 } |
| 3301 | 3329 |
| 3302 } // namespace blink | 3330 } // namespace blink |
| OLD | NEW |