| 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/ScriptState.h" | 7 #include "bindings/core/v8/ScriptState.h" |
| 8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 9 #include "core/dom/DocumentUserGestureToken.h" | 9 #include "core/dom/DocumentUserGestureToken.h" |
| 10 #include "core/dom/ExecutionContext.h" | 10 #include "core/dom/ExecutionContext.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 return new MediaSession(scriptState); | 76 return new MediaSession(scriptState); |
| 77 } | 77 } |
| 78 | 78 |
| 79 void MediaSession::dispose() { | 79 void MediaSession::dispose() { |
| 80 m_clientBinding.Close(); | 80 m_clientBinding.Close(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void MediaSession::setMetadata(MediaMetadata* metadata) { | 83 void MediaSession::setMetadata(MediaMetadata* metadata) { |
| 84 if (mojom::blink::MediaSessionService* service = | 84 if (mojom::blink::MediaSessionService* service = |
| 85 getService(m_scriptState.get())) { | 85 getService(m_scriptState.get())) { |
| 86 service->SetMetadata( | 86 service->SetMetadata(MediaMetadataSanitizer::sanitizeAndConvertToMojo( |
| 87 MediaMetadataSanitizer::sanitizeAndConvertToMojo(metadata)); | 87 metadata, getExecutionContext())); |
| 88 } | 88 } |
| 89 } | 89 } |
| 90 | 90 |
| 91 MediaMetadata* MediaSession::metadata() const { | 91 MediaMetadata* MediaSession::metadata() const { |
| 92 return m_metadata; | 92 return m_metadata; |
| 93 } | 93 } |
| 94 | 94 |
| 95 const WTF::AtomicString& MediaSession::interfaceName() const { | 95 const WTF::AtomicString& MediaSession::interfaceName() const { |
| 96 return EventTargetNames::MediaSession; | 96 return EventTargetNames::MediaSession; |
| 97 } | 97 } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 DocumentUserGestureToken::create(document)); | 156 DocumentUserGestureToken::create(document)); |
| 157 dispatchEvent(Event::create(mojomActionToEventName(action))); | 157 dispatchEvent(Event::create(mojomActionToEventName(action))); |
| 158 } | 158 } |
| 159 | 159 |
| 160 DEFINE_TRACE(MediaSession) { | 160 DEFINE_TRACE(MediaSession) { |
| 161 visitor->trace(m_metadata); | 161 visitor->trace(m_metadata); |
| 162 EventTargetWithInlineData::trace(visitor); | 162 EventTargetWithInlineData::trace(visitor); |
| 163 } | 163 } |
| 164 | 164 |
| 165 } // namespace blink | 165 } // namespace blink |
| OLD | NEW |