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

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

Issue 2252783004: Implement MediaSession (metadata) per frame [NOT READY, HAS DEPENDENCY] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed Anton's comments Created 4 years, 3 months 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "modules/mediasession/NavigatorMediaSession.h"
6
7 #include "bindings/core/v8/ExceptionStatePlaceholder.h"
8 #include "modules/mediasession/MediaSession.h"
9 #include "platform/Supplementable.h"
10
11 namespace blink {
12
13 NavigatorMediaSession::NavigatorMediaSession(Navigator& navigator)
14 : DOMWindowProperty(navigator.frame())
15 {
16 if (!frame())
17 return;
18 m_session = MediaSession::create(frame(), IGNORE_EXCEPTION);
19 }
20
21 DEFINE_TRACE(NavigatorMediaSession)
22 {
23 visitor->trace(m_session);
24 Supplement<Navigator>::trace(visitor);
25 DOMWindowProperty::trace(visitor);
26 }
27
28 const char* NavigatorMediaSession::supplementName()
29 {
30 return "NavigatorMediaSession";
31 }
32
33 NavigatorMediaSession& NavigatorMediaSession::from(Navigator& navigator)
34 {
35 NavigatorMediaSession* supplement = static_cast<NavigatorMediaSession*>(Supp lement<Navigator>::from(navigator, supplementName()));
36 if (!supplement) {
37 supplement = new NavigatorMediaSession(navigator);
38 provideTo(navigator, supplementName(), supplement);
39 }
40 return *supplement;
41 }
42
43 MediaSession* NavigatorMediaSession::mediaSession(Navigator& navigator)
44 {
45 return NavigatorMediaSession::from(navigator).m_session.get();
46 }
47 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698