| 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 | 262 |
| 263 void RemotePlayback::remotePlaybackDisabled() { | 263 void RemotePlayback::remotePlaybackDisabled() { |
| 264 if (m_promptPromiseResolver) { | 264 if (m_promptPromiseResolver) { |
| 265 m_promptPromiseResolver->reject(DOMException::create( | 265 m_promptPromiseResolver->reject(DOMException::create( |
| 266 InvalidStateError, "disableRemotePlayback attribute is present.")); | 266 InvalidStateError, "disableRemotePlayback attribute is present.")); |
| 267 m_promptPromiseResolver = nullptr; | 267 m_promptPromiseResolver = nullptr; |
| 268 } | 268 } |
| 269 | 269 |
| 270 m_availabilityCallbacks.clear(); | 270 m_availabilityCallbacks.clear(); |
| 271 | 271 |
| 272 // TODO(avayvod): stop remote playback too. https://crbug.com/657566. | 272 if (m_state != WebRemotePlaybackState::Disconnected) |
| 273 m_mediaElement->requestRemotePlaybackStop(); |
| 273 } | 274 } |
| 274 | 275 |
| 275 void RemotePlayback::setV8ReferencesForCallbacks( | 276 void RemotePlayback::setV8ReferencesForCallbacks( |
| 276 v8::Isolate* isolate, | 277 v8::Isolate* isolate, |
| 277 const v8::Persistent<v8::Object>& wrapper) { | 278 const v8::Persistent<v8::Object>& wrapper) { |
| 278 for (auto callback : m_availabilityCallbacks.values()) | 279 for (auto callback : m_availabilityCallbacks.values()) |
| 279 callback->setWrapperReference(isolate, wrapper); | 280 callback->setWrapperReference(isolate, wrapper); |
| 280 } | 281 } |
| 281 | 282 |
| 282 DEFINE_TRACE(RemotePlayback) { | 283 DEFINE_TRACE(RemotePlayback) { |
| 283 visitor->trace(m_availabilityCallbacks); | 284 visitor->trace(m_availabilityCallbacks); |
| 284 visitor->trace(m_promptPromiseResolver); | 285 visitor->trace(m_promptPromiseResolver); |
| 285 visitor->trace(m_mediaElement); | 286 visitor->trace(m_mediaElement); |
| 286 EventTargetWithInlineData::trace(visitor); | 287 EventTargetWithInlineData::trace(visitor); |
| 287 } | 288 } |
| 288 | 289 |
| 289 DEFINE_TRACE_WRAPPERS(RemotePlayback) { | 290 DEFINE_TRACE_WRAPPERS(RemotePlayback) { |
| 290 for (auto callback : m_availabilityCallbacks.values()) { | 291 for (auto callback : m_availabilityCallbacks.values()) { |
| 291 visitor->traceWrappers(callback); | 292 visitor->traceWrappers(callback); |
| 292 } | 293 } |
| 293 EventTargetWithInlineData::traceWrappers(visitor); | 294 EventTargetWithInlineData::traceWrappers(visitor); |
| 294 } | 295 } |
| 295 | 296 |
| 296 } // namespace blink | 297 } // namespace blink |
| OLD | NEW |