| 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 3067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3078 } else if (type == "none") { | 3078 } else if (type == "none") { |
| 3079 webtype = kWebConnectionTypeNone; | 3079 webtype = kWebConnectionTypeNone; |
| 3080 } else if (type == "unknown") { | 3080 } else if (type == "unknown") { |
| 3081 webtype = kWebConnectionTypeUnknown; | 3081 webtype = kWebConnectionTypeUnknown; |
| 3082 } else { | 3082 } else { |
| 3083 exception_state.ThrowDOMException( | 3083 exception_state.ThrowDOMException( |
| 3084 kNotFoundError, | 3084 kNotFoundError, |
| 3085 ExceptionMessages::FailedToEnumerate("connection type", type)); | 3085 ExceptionMessages::FailedToEnumerate("connection type", type)); |
| 3086 return; | 3086 return; |
| 3087 } | 3087 } |
| 3088 GetNetworkStateNotifier().SetOverride(on_line, webtype, downlink_max_mbps); | 3088 GetNetworkStateNotifier().SetNetworkConnectionInfoOverride(on_line, webtype, |
| 3089 downlink_max_mbps); |
| 3090 } |
| 3091 |
| 3092 void Internals::setNetworkQualityInfoOverride(const String& effective_type, |
| 3093 unsigned long transport_rtt_msec, |
| 3094 double downlink_throughput_mbps, |
| 3095 ExceptionState& exception_state) { |
| 3096 WebEffectiveConnectionType web_effective_type = |
| 3097 WebEffectiveConnectionType::kTypeUnknown; |
| 3098 if (effective_type == "offline") { |
| 3099 web_effective_type = WebEffectiveConnectionType::kTypeOffline; |
| 3100 } else if (effective_type == "slow-2g") { |
| 3101 web_effective_type = WebEffectiveConnectionType::kTypeSlow2G; |
| 3102 } else if (effective_type == "2g") { |
| 3103 web_effective_type = WebEffectiveConnectionType::kType2G; |
| 3104 } else if (effective_type == "3g") { |
| 3105 web_effective_type = WebEffectiveConnectionType::kType3G; |
| 3106 } else if (effective_type == "4g") { |
| 3107 web_effective_type = WebEffectiveConnectionType::kType4G; |
| 3108 } else if (effective_type != "unknown") { |
| 3109 exception_state.ThrowDOMException( |
| 3110 kNotFoundError, ExceptionMessages::FailedToEnumerate( |
| 3111 "effective connection type", effective_type)); |
| 3112 return; |
| 3113 } |
| 3114 |
| 3115 GetNetworkStateNotifier().SetNetworkQualityInfoOverride( |
| 3116 web_effective_type, transport_rtt_msec, downlink_throughput_mbps); |
| 3089 } | 3117 } |
| 3090 | 3118 |
| 3091 void Internals::clearNetworkConnectionInfoOverride() { | 3119 void Internals::clearNetworkConnectionInfoOverride() { |
| 3092 GetNetworkStateNotifier().ClearOverride(); | 3120 GetNetworkStateNotifier().ClearOverride(); |
| 3093 } | 3121 } |
| 3094 | 3122 |
| 3095 unsigned Internals::countHitRegions(CanvasRenderingContext* context) { | 3123 unsigned Internals::countHitRegions(CanvasRenderingContext* context) { |
| 3096 return context->HitRegionsCount(); | 3124 return context->HitRegionsCount(); |
| 3097 } | 3125 } |
| 3098 | 3126 |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3290 | 3318 |
| 3291 void Internals::crash() { | 3319 void Internals::crash() { |
| 3292 CHECK(false) << "Intentional crash"; | 3320 CHECK(false) << "Intentional crash"; |
| 3293 } | 3321 } |
| 3294 | 3322 |
| 3295 void Internals::setIsLowEndDevice(bool is_low_end_device) { | 3323 void Internals::setIsLowEndDevice(bool is_low_end_device) { |
| 3296 MemoryCoordinator::SetIsLowEndDeviceForTesting(is_low_end_device); | 3324 MemoryCoordinator::SetIsLowEndDeviceForTesting(is_low_end_device); |
| 3297 } | 3325 } |
| 3298 | 3326 |
| 3299 } // namespace blink | 3327 } // namespace blink |
| OLD | NEW |