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/ExecutionContext.h" | 9 #include "core/dom/ExecutionContext.h" |
10 #include "modules/audio_output_devices/AudioOutputDeviceClient.h" | 10 #include "modules/audio_output_devices/AudioOutputDeviceClient.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 { | 49 { |
50 } | 50 } |
51 | 51 |
52 void SetSinkIdResolver::startAsync() | 52 void SetSinkIdResolver::startAsync() |
53 { | 53 { |
54 m_timer.startOneShot(0, BLINK_FROM_HERE); | 54 m_timer.startOneShot(0, BLINK_FROM_HERE); |
55 } | 55 } |
56 | 56 |
57 void SetSinkIdResolver::timerFired(Timer<SetSinkIdResolver>* timer) | 57 void SetSinkIdResolver::timerFired(Timer<SetSinkIdResolver>* timer) |
58 { | 58 { |
59 ExecutionContext* context = executionContext(); | 59 ExecutionContext* context = getExecutionContext(); |
60 ASSERT(context && context->isDocument()); | 60 ASSERT(context && context->isDocument()); |
61 OwnPtr<SetSinkIdCallbacks> callbacks = adoptPtr(new SetSinkIdCallbacks(this,
*m_element, m_sinkId)); | 61 OwnPtr<SetSinkIdCallbacks> callbacks = adoptPtr(new SetSinkIdCallbacks(this,
*m_element, m_sinkId)); |
62 WebMediaPlayer* webMediaPlayer = m_element->webMediaPlayer(); | 62 WebMediaPlayer* webMediaPlayer = m_element->webMediaPlayer(); |
63 if (webMediaPlayer) { | 63 if (webMediaPlayer) { |
64 // Using leakPtr() to transfer ownership because |webMediaPlayer| is a p
latform object that takes raw pointers | 64 // Using leakPtr() to transfer ownership because |webMediaPlayer| is a p
latform object that takes raw pointers |
65 webMediaPlayer->setSinkId(m_sinkId, WebSecurityOrigin(context->securityO
rigin()), callbacks.leakPtr()); | 65 webMediaPlayer->setSinkId(m_sinkId, WebSecurityOrigin(context->getSecuri
tyOrigin()), callbacks.leakPtr()); |
66 } else { | 66 } else { |
67 if (AudioOutputDeviceClient* client = AudioOutputDeviceClient::from(cont
ext)) { | 67 if (AudioOutputDeviceClient* client = AudioOutputDeviceClient::from(cont
ext)) { |
68 client->checkIfAudioSinkExistsAndIsAuthorized(context, m_sinkId, cal
lbacks.release()); | 68 client->checkIfAudioSinkExistsAndIsAuthorized(context, m_sinkId, cal
lbacks.release()); |
69 } else { | 69 } else { |
70 // The context has been detached. Impossible to get a security origi
n to check. | 70 // The context has been detached. Impossible to get a security origi
n to check. |
71 ASSERT(context->activeDOMObjectsAreStopped()); | 71 ASSERT(context->activeDOMObjectsAreStopped()); |
72 reject(DOMException::create(SecurityError, "Impossible to authorize
device for detached context")); | 72 reject(DOMException::create(SecurityError, "Impossible to authorize
device for detached context")); |
73 } | 73 } |
74 } | 74 } |
75 } | 75 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 } | 124 } |
125 return *supplement; | 125 return *supplement; |
126 } | 126 } |
127 | 127 |
128 DEFINE_TRACE(HTMLMediaElementAudioOutputDevice) | 128 DEFINE_TRACE(HTMLMediaElementAudioOutputDevice) |
129 { | 129 { |
130 WillBeHeapSupplement<HTMLMediaElement>::trace(visitor); | 130 WillBeHeapSupplement<HTMLMediaElement>::trace(visitor); |
131 } | 131 } |
132 | 132 |
133 } // namespace blink | 133 } // namespace blink |
OLD | NEW |