| 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/AudioOutputDeviceClient.h" | 5 #include "modules/audio_output_devices/AudioOutputDeviceClient.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/dom/ExecutionContext.h" | 8 #include "core/dom/ExecutionContext.h" |
| 9 #include "core/frame/LocalFrame.h" | |
| 10 | 9 |
| 11 namespace blink { | 10 namespace blink { |
| 12 | 11 |
| 13 const char* AudioOutputDeviceClient::supplementName() | 12 const char* AudioOutputDeviceClient::supplementName() |
| 14 { | 13 { |
| 15 return "AudioOutputDeviceClient"; | 14 return "AudioOutputDeviceClient"; |
| 16 } | 15 } |
| 17 | 16 |
| 17 AudioOutputDeviceClient::AudioOutputDeviceClient(LocalFrame& frame) |
| 18 : Supplement<LocalFrame>(frame) |
| 19 { |
| 20 } |
| 21 |
| 18 AudioOutputDeviceClient* AudioOutputDeviceClient::from(ExecutionContext* context
) | 22 AudioOutputDeviceClient* AudioOutputDeviceClient::from(ExecutionContext* context
) |
| 19 { | 23 { |
| 20 if (!context->isDocument()) | 24 if (!context->isDocument()) |
| 21 return nullptr; | 25 return nullptr; |
| 22 | 26 |
| 23 const Document* document = toDocument(context); | 27 const Document* document = toDocument(context); |
| 24 if (!document->frame()) | 28 if (!document->frame()) |
| 25 return nullptr; | 29 return nullptr; |
| 26 | 30 |
| 27 return static_cast<AudioOutputDeviceClient*>(Supplement<LocalFrame>::from(do
cument->frame(), supplementName())); | 31 return static_cast<AudioOutputDeviceClient*>(Supplement<LocalFrame>::from(do
cument->frame(), supplementName())); |
| 28 } | 32 } |
| 29 | 33 |
| 30 void provideAudioOutputDeviceClientTo(LocalFrame& frame, AudioOutputDeviceClient
* client) | 34 void provideAudioOutputDeviceClientTo(LocalFrame& frame, AudioOutputDeviceClient
* client) |
| 31 { | 35 { |
| 32 frame.provideSupplement(AudioOutputDeviceClient::supplementName(), client); | 36 frame.provideSupplement(AudioOutputDeviceClient::supplementName(), client); |
| 33 } | 37 } |
| 34 | 38 |
| 35 DEFINE_TRACE(AudioOutputDeviceClient) | 39 DEFINE_TRACE(AudioOutputDeviceClient) |
| 36 { | 40 { |
| 37 Supplement<LocalFrame>::trace(visitor); | 41 Supplement<LocalFrame>::trace(visitor); |
| 38 } | 42 } |
| 39 | 43 |
| 40 } // namespace blink | 44 } // namespace blink |
| OLD | NEW |