OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "config.h" |
| 6 #include "modules/audio_output_devices/AudioOutputDeviceClient.h" |
| 7 |
| 8 #include "core/dom/Document.h" |
| 9 #include "core/dom/ExecutionContext.h" |
| 10 #include "core/frame/LocalFrame.h" |
| 11 |
| 12 namespace blink { |
| 13 |
| 14 const char* AudioOutputDeviceClient::supplementName() |
| 15 { |
| 16 return "AudioOutputDeviceClient"; |
| 17 } |
| 18 |
| 19 AudioOutputDeviceClient* AudioOutputDeviceClient::from(ExecutionContext* context
) |
| 20 { |
| 21 if (!context->isDocument()) |
| 22 return nullptr; |
| 23 |
| 24 const Document* document = toDocument(context); |
| 25 if (!document->frame() || !document->frame()->isLocalFrame()) |
| 26 return nullptr; |
| 27 |
| 28 return static_cast<AudioOutputDeviceClient*>(WillBeHeapSupplement<LocalFrame
>::from(document->frame(), supplementName())); |
| 29 } |
| 30 |
| 31 void provideAudioOutputDeviceClientTo(LocalFrame& frame, PassOwnPtrWillBeRawPtr<
AudioOutputDeviceClient> client) |
| 32 { |
| 33 frame.provideSupplement(AudioOutputDeviceClient::supplementName(), client); |
| 34 } |
| 35 |
| 36 } // namespace blink |
OLD | NEW |