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