Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(695)

Side by Side Diff: third_party/WebKit/Source/modules/audio_output_devices/AudioOutputDeviceClient.cpp

Issue 2614143002: Use a new Supplement constructor for LocalFrame's supplements (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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" 9 #include "core/frame/LocalFrame.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 AudioOutputDeviceClient::AudioOutputDeviceClient(LocalFrame& frame)
14 : Supplement<LocalFrame>(frame) {}
15
13 const char* AudioOutputDeviceClient::supplementName() { 16 const char* AudioOutputDeviceClient::supplementName() {
14 return "AudioOutputDeviceClient"; 17 return "AudioOutputDeviceClient";
15 } 18 }
16 19
17 AudioOutputDeviceClient* AudioOutputDeviceClient::from( 20 AudioOutputDeviceClient* AudioOutputDeviceClient::from(
18 ExecutionContext* context) { 21 ExecutionContext* context) {
19 if (!context || !context->isDocument()) 22 if (!context || !context->isDocument())
20 return nullptr; 23 return nullptr;
21 24
22 const Document* document = toDocument(context); 25 const Document* document = toDocument(context);
23 if (!document->frame()) 26 if (!document->frame())
24 return nullptr; 27 return nullptr;
25 28
26 return static_cast<AudioOutputDeviceClient*>( 29 return static_cast<AudioOutputDeviceClient*>(
27 Supplement<LocalFrame>::from(document->frame(), supplementName())); 30 Supplement<LocalFrame>::from(document->frame(), supplementName()));
28 } 31 }
29 32
30 void provideAudioOutputDeviceClientTo(LocalFrame& frame, 33 void provideAudioOutputDeviceClientTo(LocalFrame& frame,
31 AudioOutputDeviceClient* client) { 34 AudioOutputDeviceClient* client) {
32 frame.provideSupplement(AudioOutputDeviceClient::supplementName(), client); 35 Supplement<LocalFrame>::provideTo(
36 frame, AudioOutputDeviceClient::supplementName(), client);
33 } 37 }
34 38
35 DEFINE_TRACE(AudioOutputDeviceClient) { 39 DEFINE_TRACE(AudioOutputDeviceClient) {
36 Supplement<LocalFrame>::trace(visitor); 40 Supplement<LocalFrame>::trace(visitor);
37 } 41 }
38 42
39 } // namespace blink 43 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698