| 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/audio_output_devices/HTMLMediaElementAudioOutputDevice.h" | 5 #include "modules/audio_output_devices/HTMLMediaElementAudioOutputDevice.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptPromiseResolver.h" | 7 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 8 #include "bindings/core/v8/ScriptState.h" | 8 #include "bindings/core/v8/ScriptState.h" |
| 9 #include "core/dom/DOMException.h" | 9 #include "core/dom/DOMException.h" |
| 10 #include "core/dom/ExecutionContext.h" | 10 #include "core/dom/ExecutionContext.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 { | 59 { |
| 60 ExecutionContext* context = getExecutionContext(); | 60 ExecutionContext* context = getExecutionContext(); |
| 61 ASSERT(context && context->isDocument()); | 61 ASSERT(context && context->isDocument()); |
| 62 OwnPtr<SetSinkIdCallbacks> callbacks = adoptPtr(new SetSinkIdCallbacks(this,
*m_element, m_sinkId)); | 62 OwnPtr<SetSinkIdCallbacks> callbacks = adoptPtr(new SetSinkIdCallbacks(this,
*m_element, m_sinkId)); |
| 63 WebMediaPlayer* webMediaPlayer = m_element->webMediaPlayer(); | 63 WebMediaPlayer* webMediaPlayer = m_element->webMediaPlayer(); |
| 64 if (webMediaPlayer) { | 64 if (webMediaPlayer) { |
| 65 // Using leakPtr() to transfer ownership because |webMediaPlayer| is a p
latform object that takes raw pointers | 65 // Using leakPtr() to transfer ownership because |webMediaPlayer| is a p
latform object that takes raw pointers |
| 66 webMediaPlayer->setSinkId(m_sinkId, WebSecurityOrigin(context->getSecuri
tyOrigin()), callbacks.leakPtr()); | 66 webMediaPlayer->setSinkId(m_sinkId, WebSecurityOrigin(context->getSecuri
tyOrigin()), callbacks.leakPtr()); |
| 67 } else { | 67 } else { |
| 68 if (AudioOutputDeviceClient* client = AudioOutputDeviceClient::from(cont
ext)) { | 68 if (AudioOutputDeviceClient* client = AudioOutputDeviceClient::from(cont
ext)) { |
| 69 client->checkIfAudioSinkExistsAndIsAuthorized(context, m_sinkId, cal
lbacks.release()); | 69 client->checkIfAudioSinkExistsAndIsAuthorized(context, m_sinkId, std
::move(callbacks)); |
| 70 } else { | 70 } else { |
| 71 // The context has been detached. Impossible to get a security origi
n to check. | 71 // The context has been detached. Impossible to get a security origi
n to check. |
| 72 ASSERT(context->activeDOMObjectsAreStopped()); | 72 ASSERT(context->activeDOMObjectsAreStopped()); |
| 73 reject(DOMException::create(SecurityError, "Impossible to authorize
device for detached context")); | 73 reject(DOMException::create(SecurityError, "Impossible to authorize
device for detached context")); |
| 74 } | 74 } |
| 75 } | 75 } |
| 76 } | 76 } |
| 77 | 77 |
| 78 DEFINE_TRACE(SetSinkIdResolver) | 78 DEFINE_TRACE(SetSinkIdResolver) |
| 79 { | 79 { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 } | 125 } |
| 126 return *supplement; | 126 return *supplement; |
| 127 } | 127 } |
| 128 | 128 |
| 129 DEFINE_TRACE(HTMLMediaElementAudioOutputDevice) | 129 DEFINE_TRACE(HTMLMediaElementAudioOutputDevice) |
| 130 { | 130 { |
| 131 Supplement<HTMLMediaElement>::trace(visitor); | 131 Supplement<HTMLMediaElement>::trace(visitor); |
| 132 } | 132 } |
| 133 | 133 |
| 134 } // namespace blink | 134 } // namespace blink |
| OLD | NEW |