| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/mediasession/MediaSession.h" | 5 #include "modules/mediasession/MediaSession.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/CallbackPromiseAdapter.h" | 7 #include "bindings/core/v8/CallbackPromiseAdapter.h" |
| 8 #include "bindings/core/v8/ScriptPromiseResolver.h" | 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 9 #include "bindings/core/v8/ScriptState.h" | 9 #include "bindings/core/v8/ScriptState.h" |
| 10 #include "core/dom/DOMException.h" | 10 #include "core/dom/DOMException.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState)
; | 50 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState)
; |
| 51 ScriptPromise promise = resolver->promise(); | 51 ScriptPromise promise = resolver->promise(); |
| 52 | 52 |
| 53 m_webMediaSession->deactivate(new CallbackPromiseAdapter<void, void>(resolve
r)); | 53 m_webMediaSession->deactivate(new CallbackPromiseAdapter<void, void>(resolve
r)); |
| 54 return promise; | 54 return promise; |
| 55 } | 55 } |
| 56 | 56 |
| 57 void MediaSession::setMetadata(MediaMetadata* metadata) | 57 void MediaSession::setMetadata(MediaMetadata* metadata) |
| 58 { | 58 { |
| 59 m_metadata = metadata; | 59 m_metadata = metadata; |
| 60 | 60 if (metadata) { |
| 61 m_webMediaSession->setMetadata(m_metadata ? m_metadata->data() : nullptr); | 61 WebMediaMetadata webMetadata = (WebMediaMetadata) *metadata; |
| 62 m_webMediaSession->setMetadata(&webMetadata); |
| 63 } else { |
| 64 m_webMediaSession->setMetadata(nullptr); |
| 65 } |
| 62 } | 66 } |
| 63 | 67 |
| 64 MediaMetadata* MediaSession::metadata() const | 68 MediaMetadata* MediaSession::metadata() const |
| 65 { | 69 { |
| 66 return m_metadata; | 70 return m_metadata; |
| 67 } | 71 } |
| 68 | 72 |
| 69 DEFINE_TRACE(MediaSession) | 73 DEFINE_TRACE(MediaSession) |
| 70 { | 74 { |
| 71 visitor->trace(m_metadata); | 75 visitor->trace(m_metadata); |
| 72 } | 76 } |
| 73 | 77 |
| 74 } // namespace blink | 78 } // namespace blink |
| OLD | NEW |