Chromium Code Reviews| 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/ExecutionContext.h" | 9 #include "core/dom/ExecutionContext.h" |
| 10 #include "core/events/Event.h" | 10 #include "core/events/Event.h" |
| 11 #include "core/frame/LocalFrame.h" | 11 #include "core/frame/LocalFrame.h" |
| 12 #include "modules/EventTargetModules.h" | 12 #include "modules/EventTargetModules.h" |
| 13 #include "modules/mediasession/MediaMetadata.h" | 13 #include "modules/mediasession/MediaMetadata.h" |
| 14 #include "modules/mediasession/MediaMetadataSanitizer.h" | 14 #include "modules/mediasession/MediaMetadataSanitizer.h" |
| 15 #include "platform/UserGestureIndicator.h" | |
| 15 #include "public/platform/InterfaceProvider.h" | 16 #include "public/platform/InterfaceProvider.h" |
| 16 #include "wtf/Optional.h" | 17 #include "wtf/Optional.h" |
| 17 #include <memory> | 18 #include <memory> |
| 18 | 19 |
| 19 namespace blink { | 20 namespace blink { |
| 20 | 21 |
| 21 namespace { | 22 namespace { |
| 22 | 23 |
| 23 using ::blink::mojom::blink::MediaSessionAction; | 24 using ::blink::mojom::blink::MediaSessionAction; |
| 24 | 25 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 141 getService(m_scriptState.get())) { | 142 getService(m_scriptState.get())) { |
| 142 auto mojomAction = eventNameToMojomAction(eventType); | 143 auto mojomAction = eventNameToMojomAction(eventType); |
| 143 DCHECK(mojomAction.has_value()); | 144 DCHECK(mojomAction.has_value()); |
| 144 service->DisableAction(mojomAction.value()); | 145 service->DisableAction(mojomAction.value()); |
| 145 } | 146 } |
| 146 return EventTarget::removeEventListenerInternal(eventType, listener, options); | 147 return EventTarget::removeEventListenerInternal(eventType, listener, options); |
| 147 } | 148 } |
| 148 | 149 |
| 149 void MediaSession::DidReceiveAction( | 150 void MediaSession::DidReceiveAction( |
| 150 blink::mojom::blink::MediaSessionAction action) { | 151 blink::mojom::blink::MediaSessionAction action) { |
| 152 UserGestureIndicator gestureIndicator(UserGestureToken::create()); | |
|
whywhat
2016/10/24 20:54:01
Have you checked this actually sets the user gestu
mlamouri (slow - plz ping)
2016/10/25 10:38:13
I think dispatchEvent() is sync, see EventTarget::
| |
| 151 dispatchEvent(Event::create(mojomActionToEventName(action))); | 153 dispatchEvent(Event::create(mojomActionToEventName(action))); |
| 152 } | 154 } |
| 153 | 155 |
| 154 DEFINE_TRACE(MediaSession) { | 156 DEFINE_TRACE(MediaSession) { |
| 155 visitor->trace(m_metadata); | 157 visitor->trace(m_metadata); |
| 156 EventTargetWithInlineData::trace(visitor); | 158 EventTargetWithInlineData::trace(visitor); |
| 157 } | 159 } |
| 158 | 160 |
| 159 } // namespace blink | 161 } // namespace blink |
| OLD | NEW |