OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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/NavigatorMediaSession.h" | 5 #include "modules/mediasession/NavigatorMediaSession.h" |
6 | 6 |
7 #include "bindings/core/v8/ScriptState.h" | 7 #include "bindings/core/v8/ScriptState.h" |
| 8 #include "core/dom/ExecutionContext.h" |
8 #include "modules/mediasession/MediaSession.h" | 9 #include "modules/mediasession/MediaSession.h" |
9 #include "platform/Supplementable.h" | 10 #include "platform/Supplementable.h" |
10 | 11 |
11 namespace blink { | 12 namespace blink { |
12 | 13 |
13 NavigatorMediaSession::NavigatorMediaSession(Navigator& navigator) | 14 NavigatorMediaSession::NavigatorMediaSession(Navigator& navigator) |
14 : Supplement<Navigator>(navigator) {} | 15 : Supplement<Navigator>(navigator) {} |
15 | 16 |
16 DEFINE_TRACE(NavigatorMediaSession) { | 17 DEFINE_TRACE(NavigatorMediaSession) { |
17 visitor->Trace(session_); | 18 visitor->Trace(session_); |
(...skipping 11 matching lines...) Expand all Loading... |
29 supplement = new NavigatorMediaSession(navigator); | 30 supplement = new NavigatorMediaSession(navigator); |
30 ProvideTo(navigator, SupplementName(), supplement); | 31 ProvideTo(navigator, SupplementName(), supplement); |
31 } | 32 } |
32 return *supplement; | 33 return *supplement; |
33 } | 34 } |
34 | 35 |
35 MediaSession* NavigatorMediaSession::mediaSession(ScriptState* script_state, | 36 MediaSession* NavigatorMediaSession::mediaSession(ScriptState* script_state, |
36 Navigator& navigator) { | 37 Navigator& navigator) { |
37 NavigatorMediaSession& self = NavigatorMediaSession::From(navigator); | 38 NavigatorMediaSession& self = NavigatorMediaSession::From(navigator); |
38 if (!self.session_) | 39 if (!self.session_) |
39 self.session_ = MediaSession::Create(script_state->GetExecutionContext()); | 40 self.session_ = MediaSession::Create(ExecutionContext::From(script_state)); |
40 return self.session_.Get(); | 41 return self.session_.Get(); |
41 } | 42 } |
42 | 43 |
43 } // namespace blink | 44 } // namespace blink |
OLD | NEW |