| 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/modules/v8/MediaSessionActionHandler.h" | 7 #include "bindings/modules/v8/MediaSessionActionHandler.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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 action, TraceWrapperMember<MediaSessionActionHandler>(this, handler)); | 157 action, TraceWrapperMember<MediaSessionActionHandler>(this, handler)); |
| 158 | 158 |
| 159 if (!addResult.isNewEntry) | 159 if (!addResult.isNewEntry) |
| 160 return; | 160 return; |
| 161 | 161 |
| 162 notifyActionChange(action, ActionChangeType::ActionEnabled); | 162 notifyActionChange(action, ActionChangeType::ActionEnabled); |
| 163 } else { | 163 } else { |
| 164 if (m_actionHandlers.find(action) == m_actionHandlers.end()) | 164 if (m_actionHandlers.find(action) == m_actionHandlers.end()) |
| 165 return; | 165 return; |
| 166 | 166 |
| 167 m_actionHandlers.remove(action); | 167 m_actionHandlers.erase(action); |
| 168 | 168 |
| 169 notifyActionChange(action, ActionChangeType::ActionDisabled); | 169 notifyActionChange(action, ActionChangeType::ActionDisabled); |
| 170 } | 170 } |
| 171 } | 171 } |
| 172 | 172 |
| 173 void MediaSession::notifyActionChange(const String& action, | 173 void MediaSession::notifyActionChange(const String& action, |
| 174 ActionChangeType type) { | 174 ActionChangeType type) { |
| 175 mojom::blink::MediaSessionService* service = getService(); | 175 mojom::blink::MediaSessionService* service = getService(); |
| 176 if (!service) | 176 if (!service) |
| 177 return; | 177 return; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 visitor->trace(m_actionHandlers); | 242 visitor->trace(m_actionHandlers); |
| 243 ContextClient::trace(visitor); | 243 ContextClient::trace(visitor); |
| 244 } | 244 } |
| 245 | 245 |
| 246 DEFINE_TRACE_WRAPPERS(MediaSession) { | 246 DEFINE_TRACE_WRAPPERS(MediaSession) { |
| 247 for (auto handler : m_actionHandlers.values()) | 247 for (auto handler : m_actionHandlers.values()) |
| 248 visitor->traceWrappers(handler); | 248 visitor->traceWrappers(handler); |
| 249 } | 249 } |
| 250 | 250 |
| 251 } // namespace blink | 251 } // namespace blink |
| OLD | NEW |