Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(653)

Side by Side Diff: third_party/WebKit/Source/modules/mediasession/MediaSession.cpp

Issue 2497493005: Reordering MediaSessionAction seek backward/forward (Closed)
Patch Set: rebased Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 18 matching lines...) Expand all
29 case MediaSessionAction::PLAY: 29 case MediaSessionAction::PLAY:
30 return EventTypeNames::play; 30 return EventTypeNames::play;
31 case MediaSessionAction::PAUSE: 31 case MediaSessionAction::PAUSE:
32 return EventTypeNames::pause; 32 return EventTypeNames::pause;
33 case MediaSessionAction::PLAY_PAUSE: 33 case MediaSessionAction::PLAY_PAUSE:
34 return EventTypeNames::playpause; 34 return EventTypeNames::playpause;
35 case MediaSessionAction::PREVIOUS_TRACK: 35 case MediaSessionAction::PREVIOUS_TRACK:
36 return EventTypeNames::previoustrack; 36 return EventTypeNames::previoustrack;
37 case MediaSessionAction::NEXT_TRACK: 37 case MediaSessionAction::NEXT_TRACK:
38 return EventTypeNames::nexttrack; 38 return EventTypeNames::nexttrack;
39 case MediaSessionAction::SEEK_BACKWARD:
40 return EventTypeNames::seekbackward;
39 case MediaSessionAction::SEEK_FORWARD: 41 case MediaSessionAction::SEEK_FORWARD:
40 return EventTypeNames::seekforward; 42 return EventTypeNames::seekforward;
41 case MediaSessionAction::SEEK_BACKWARD:
42 return EventTypeNames::seekbackward;
43 default: 43 default:
44 NOTREACHED(); 44 NOTREACHED();
45 } 45 }
46 return WTF::emptyAtom; 46 return WTF::emptyAtom;
47 } 47 }
48 48
49 WTF::Optional<MediaSessionAction> eventNameToMojomAction( 49 WTF::Optional<MediaSessionAction> eventNameToMojomAction(
50 const AtomicString& eventName) { 50 const AtomicString& eventName) {
51 if (EventTypeNames::play == eventName) 51 if (EventTypeNames::play == eventName)
52 return MediaSessionAction::PLAY; 52 return MediaSessionAction::PLAY;
53 if (EventTypeNames::pause == eventName) 53 if (EventTypeNames::pause == eventName)
54 return MediaSessionAction::PAUSE; 54 return MediaSessionAction::PAUSE;
55 if (EventTypeNames::playpause == eventName) 55 if (EventTypeNames::playpause == eventName)
56 return MediaSessionAction::PLAY_PAUSE; 56 return MediaSessionAction::PLAY_PAUSE;
57 if (EventTypeNames::previoustrack == eventName) 57 if (EventTypeNames::previoustrack == eventName)
58 return MediaSessionAction::PREVIOUS_TRACK; 58 return MediaSessionAction::PREVIOUS_TRACK;
59 if (EventTypeNames::nexttrack == eventName) 59 if (EventTypeNames::nexttrack == eventName)
60 return MediaSessionAction::NEXT_TRACK; 60 return MediaSessionAction::NEXT_TRACK;
61 if (EventTypeNames::seekbackward == eventName)
62 return MediaSessionAction::SEEK_BACKWARD;
61 if (EventTypeNames::seekforward == eventName) 63 if (EventTypeNames::seekforward == eventName)
62 return MediaSessionAction::SEEK_FORWARD; 64 return MediaSessionAction::SEEK_FORWARD;
63 if (EventTypeNames::seekbackward == eventName)
64 return MediaSessionAction::SEEK_BACKWARD;
65 65
66 NOTREACHED(); 66 NOTREACHED();
67 return WTF::nullopt; 67 return WTF::nullopt;
68 } 68 }
69 69
70 } // anonymous namespace 70 } // anonymous namespace
71 71
72 MediaSession::MediaSession(ScriptState* scriptState) 72 MediaSession::MediaSession(ScriptState* scriptState)
73 : m_scriptState(scriptState), m_clientBinding(this) {} 73 : m_scriptState(scriptState), m_clientBinding(this) {}
74 74
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698