| 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 27 matching lines...) Expand all Loading... |
| 38 } | 38 } |
| 39 | 39 |
| 40 } // anonymous namespace | 40 } // anonymous namespace |
| 41 | 41 |
| 42 // static | 42 // static |
| 43 RemotePlayback* RemotePlayback::create(ScriptState* scriptState, | 43 RemotePlayback* RemotePlayback::create(ScriptState* scriptState, |
| 44 HTMLMediaElement& element) { | 44 HTMLMediaElement& element) { |
| 45 DCHECK(element.document().frame()); | 45 DCHECK(element.document().frame()); |
| 46 DCHECK(scriptState); | 46 DCHECK(scriptState); |
| 47 | 47 |
| 48 RemotePlayback* remotePlayback = new RemotePlayback(scriptState, element); | 48 return new RemotePlayback(scriptState, element); |
| 49 element.setRemotePlaybackClient(remotePlayback); | |
| 50 | |
| 51 return remotePlayback; | |
| 52 } | 49 } |
| 53 | 50 |
| 54 RemotePlayback::RemotePlayback(ScriptState* scriptState, | 51 RemotePlayback::RemotePlayback(ScriptState* scriptState, |
| 55 HTMLMediaElement& element) | 52 HTMLMediaElement& element) |
| 56 : ActiveScriptWrappable(this), | 53 : ActiveScriptWrappable(this), |
| 57 m_scriptState(scriptState), | 54 m_scriptState(scriptState), |
| 58 m_state(element.isPlayingRemotely() | 55 m_state(element.isPlayingRemotely() |
| 59 ? WebRemotePlaybackState::Connected | 56 ? WebRemotePlaybackState::Connected |
| 60 : WebRemotePlaybackState::Disconnected), | 57 : WebRemotePlaybackState::Disconnected), |
| 61 m_availability(element.hasRemoteRoutes()), | 58 m_availability(element.hasRemoteRoutes()), |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 } | 284 } |
| 288 | 285 |
| 289 DEFINE_TRACE_WRAPPERS(RemotePlayback) { | 286 DEFINE_TRACE_WRAPPERS(RemotePlayback) { |
| 290 for (auto callback : m_availabilityCallbacks.values()) { | 287 for (auto callback : m_availabilityCallbacks.values()) { |
| 291 visitor->traceWrappers(callback); | 288 visitor->traceWrappers(callback); |
| 292 } | 289 } |
| 293 EventTargetWithInlineData::traceWrappers(visitor); | 290 EventTargetWithInlineData::traceWrappers(visitor); |
| 294 } | 291 } |
| 295 | 292 |
| 296 } // namespace blink | 293 } // namespace blink |
| OLD | NEW |