| 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 "core/HTMLNames.h" | 8 #include "core/HTMLNames.h" |
| 9 #include "core/dom/DOMException.h" | 9 #include "core/dom/DOMException.h" |
| 10 #include "core/dom/Document.h" | 10 #include "core/dom/Document.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 } | 58 } |
| 59 | 59 |
| 60 ExecutionContext* RemotePlayback::getExecutionContext() const { | 60 ExecutionContext* RemotePlayback::getExecutionContext() const { |
| 61 return &m_mediaElement->document(); | 61 return &m_mediaElement->document(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 ScriptPromise RemotePlayback::getAvailability(ScriptState* scriptState) { | 64 ScriptPromise RemotePlayback::getAvailability(ScriptState* scriptState) { |
| 65 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); | 65 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); |
| 66 ScriptPromise promise = resolver->promise(); | 66 ScriptPromise promise = resolver->promise(); |
| 67 | 67 |
| 68 // TODO(avayvod): currently the availability is tracked for each media element | 68 // TODO(avayvod): Currently the availability is tracked for each media element |
| 69 // as soon as it's created, we probably want to limit that to when the page/el
ement | 69 // as soon as it's created, we probably want to limit that to when the |
| 70 // is visible (see https://crbug.com/597281) and has default controls. If ther
e's | 70 // page/element is visible (see https://crbug.com/597281) and has default |
| 71 // no default controls, we should also start tracking availability on demand | 71 // controls. If there are no default controls, we should also start tracking |
| 72 // meaning the Promise returned by getAvailability() will be resolved asynchro
nously. | 72 // availability on demand meaning the Promise returned by getAvailability() |
| 73 // will be resolved asynchronously. |
| 73 RemotePlaybackAvailability* availability = | 74 RemotePlaybackAvailability* availability = |
| 74 RemotePlaybackAvailability::take(resolver, m_availability); | 75 RemotePlaybackAvailability::take(resolver, m_availability); |
| 75 m_availabilityObjects.append(availability); | 76 m_availabilityObjects.append(availability); |
| 76 resolver->resolve(availability); | 77 resolver->resolve(availability); |
| 77 return promise; | 78 return promise; |
| 78 } | 79 } |
| 79 | 80 |
| 80 ScriptPromise RemotePlayback::prompt(ScriptState* scriptState) { | 81 ScriptPromise RemotePlayback::prompt(ScriptState* scriptState) { |
| 81 // TODO(avayvod): implement steps 4, 5, 8, 9 of the algorithm. | 82 // TODO(avayvod): implement steps 4, 5, 8, 9 of the algorithm. |
| 82 // https://crbug.com/647441 | 83 // https://crbug.com/647441 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 } | 167 } |
| 167 | 168 |
| 168 DEFINE_TRACE(RemotePlayback) { | 169 DEFINE_TRACE(RemotePlayback) { |
| 169 visitor->trace(m_availabilityObjects); | 170 visitor->trace(m_availabilityObjects); |
| 170 visitor->trace(m_promptPromiseResolver); | 171 visitor->trace(m_promptPromiseResolver); |
| 171 visitor->trace(m_mediaElement); | 172 visitor->trace(m_mediaElement); |
| 172 EventTargetWithInlineData::trace(visitor); | 173 EventTargetWithInlineData::trace(visitor); |
| 173 } | 174 } |
| 174 | 175 |
| 175 } // namespace blink | 176 } // namespace blink |
| OLD | NEW |