| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "modules/remoteplayback/RemotePlayback.h" | 5 #include "modules/remoteplayback/RemotePlayback.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptPromiseResolver.h" | 7 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 8 #include "bindings/modules/v8/RemotePlaybackAvailabilityCallback.h" | 8 #include "bindings/modules/v8/RemotePlaybackAvailabilityCallback.h" |
| 9 #include "core/HTMLNames.h" | 9 #include "core/HTMLNames.h" |
| 10 #include "core/dom/DOMException.h" | 10 #include "core/dom/DOMException.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 return promise; | 170 return promise; |
| 171 } | 171 } |
| 172 | 172 |
| 173 if (prompt_promise_resolver_) { | 173 if (prompt_promise_resolver_) { |
| 174 resolver->Reject(DOMException::Create( | 174 resolver->Reject(DOMException::Create( |
| 175 kOperationError, | 175 kOperationError, |
| 176 "A prompt is already being shown for this media element.")); | 176 "A prompt is already being shown for this media element.")); |
| 177 return promise; | 177 return promise; |
| 178 } | 178 } |
| 179 | 179 |
| 180 if (!UserGestureIndicator::UtilizeUserGesture()) { | 180 if (!UserGestureIndicator::ProcessingUserGesture()) { |
| 181 resolver->Reject(DOMException::Create( | 181 resolver->Reject(DOMException::Create( |
| 182 kInvalidAccessError, | 182 kInvalidAccessError, |
| 183 "RemotePlayback::prompt() requires user gesture.")); | 183 "RemotePlayback::prompt() requires user gesture.")); |
| 184 return promise; | 184 return promise; |
| 185 } | 185 } |
| 186 | 186 |
| 187 // TODO(avayvod): don't do this check on low-end devices - merge with | 187 // TODO(avayvod): don't do this check on low-end devices - merge with |
| 188 // https://codereview.chromium.org/2475293003 | 188 // https://codereview.chromium.org/2475293003 |
| 189 if (availability_ == WebRemotePlaybackAvailability::kDeviceNotAvailable) { | 189 if (availability_ == WebRemotePlaybackAvailability::kDeviceNotAvailable) { |
| 190 resolver->Reject(DOMException::Create(kNotFoundError, | 190 resolver->Reject(DOMException::Create(kNotFoundError, |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 } | 315 } |
| 316 | 316 |
| 317 DEFINE_TRACE_WRAPPERS(RemotePlayback) { | 317 DEFINE_TRACE_WRAPPERS(RemotePlayback) { |
| 318 for (auto callback : availability_callbacks_.Values()) { | 318 for (auto callback : availability_callbacks_.Values()) { |
| 319 visitor->TraceWrappers(callback); | 319 visitor->TraceWrappers(callback); |
| 320 } | 320 } |
| 321 EventTargetWithInlineData::TraceWrappers(visitor); | 321 EventTargetWithInlineData::TraceWrappers(visitor); |
| 322 } | 322 } |
| 323 | 323 |
| 324 } // namespace blink | 324 } // namespace blink |
| OLD | NEW |