Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(661)

Side by Side Diff: third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.cpp

Issue 2468303002: [RemotePlayback] Stop remote playback when disableRemotePlayback is set (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 260
261 void RemotePlayback::remotePlaybackDisabled() { 261 void RemotePlayback::remotePlaybackDisabled() {
262 if (m_promptPromiseResolver) { 262 if (m_promptPromiseResolver) {
263 m_promptPromiseResolver->reject(DOMException::create( 263 m_promptPromiseResolver->reject(DOMException::create(
264 InvalidStateError, "disableRemotePlayback attribute is present.")); 264 InvalidStateError, "disableRemotePlayback attribute is present."));
265 m_promptPromiseResolver = nullptr; 265 m_promptPromiseResolver = nullptr;
266 } 266 }
267 267
268 m_availabilityCallbacks.clear(); 268 m_availabilityCallbacks.clear();
269 269
270 // TODO(avayvod): stop remote playback too. https://crbug.com/657566. 270 // TODO(avayvod): stop remote playback too. https://crbug.com/657566.
hubbe 2016/11/02 21:17:45 remove todo?
whywhat 2016/11/04 15:01:06 Done.
271 if (m_state != WebRemotePlaybackState::Disconnected)
272 m_mediaElement->requestRemotePlaybackStop();
mlamouri (slow - plz ping) 2016/11/03 16:12:40 What would happen if the state was `connecting` at
whywhat 2016/11/04 15:01:06 Replied.
271 } 273 }
272 274
273 void RemotePlayback::setV8ReferencesForCallbacks( 275 void RemotePlayback::setV8ReferencesForCallbacks(
274 v8::Isolate* isolate, 276 v8::Isolate* isolate,
275 const v8::Persistent<v8::Object>& wrapper) { 277 const v8::Persistent<v8::Object>& wrapper) {
276 for (auto callback : m_availabilityCallbacks.values()) 278 for (auto callback : m_availabilityCallbacks.values())
277 callback->setWrapperReference(isolate, wrapper); 279 callback->setWrapperReference(isolate, wrapper);
278 } 280 }
279 281
280 DEFINE_TRACE(RemotePlayback) { 282 DEFINE_TRACE(RemotePlayback) {
281 visitor->trace(m_availabilityCallbacks); 283 visitor->trace(m_availabilityCallbacks);
282 visitor->trace(m_promptPromiseResolver); 284 visitor->trace(m_promptPromiseResolver);
283 visitor->trace(m_mediaElement); 285 visitor->trace(m_mediaElement);
284 EventTargetWithInlineData::trace(visitor); 286 EventTargetWithInlineData::trace(visitor);
285 } 287 }
286 288
287 DEFINE_TRACE_WRAPPERS(RemotePlayback) { 289 DEFINE_TRACE_WRAPPERS(RemotePlayback) {
288 for (auto callback : m_availabilityCallbacks.values()) { 290 for (auto callback : m_availabilityCallbacks.values()) {
289 visitor->traceWrappers(callback); 291 visitor->traceWrappers(callback);
290 } 292 }
291 EventTargetWithInlineData::traceWrappers(visitor); 293 EventTargetWithInlineData::traceWrappers(visitor);
292 } 294 }
293 295
294 } // namespace blink 296 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698