Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 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 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_AUDIO_CONTROLLER_H_ | |
| 6 #define CONTENT_RENDERER_PEPPER_PEPPER_AUDIO_CONTROLLER_H_ | |
| 7 | |
| 8 #include <set> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 | |
| 12 namespace content { | |
| 13 | |
| 14 class PepperPluginInstanceImpl; | |
| 15 class PPB_Audio_Impl; | |
| 16 | |
| 17 /** | |
| 18 * This class controls all the active audio instances of a Pepper instance. | |
| 19 * This class can only be a non-shareable member of PepperPluginInstanceImpl. | |
| 20 */ | |
| 21 class PepperAudioController { | |
| 22 public: | |
| 23 explicit PepperAudioController(PepperPluginInstanceImpl* instance); | |
| 24 virtual ~PepperAudioController(); | |
| 25 | |
| 26 // Adds an audio instance to the controller. | |
| 27 void AddInstance(PPB_Audio_Impl* audio); | |
| 28 | |
| 29 // Removes an audio instance from the controller. | |
| 30 void RemoveInstance(PPB_Audio_Impl* audio); | |
| 31 | |
| 32 // Sets the volume of all delegated audio resources. | |
|
bbudge
2016/06/23 17:12:42
nit: s/delegated//
s/resources/instances
Zhiqiang Zhang (Slow)
2016/06/23 18:30:25
Done.
| |
| 33 void SetVolume(double volume); | |
| 34 | |
| 35 // The pepper instance has been deleted. This method can only be called | |
| 36 // once. The controller will be invalidated after this call, and then all | |
| 37 // other methods will be no-op. | |
| 38 void OnPepperInstanceDeleted(); | |
| 39 | |
| 40 private: | |
| 41 // Notifies the RenderFrame that the playback has stopped. This method should | |
| 42 // only be called when |ppb_audios_| turns from non-empty to empty. | |
| 43 void NotifyPlaybackStopsOnEmpty(); | |
| 44 | |
| 45 // All active audio instances. | |
| 46 std::set<PPB_Audio_Impl*> ppb_audios_; | |
| 47 | |
| 48 // The Pepper instance which this controller is for. Will be null after | |
| 49 // OnPepperInstanceDeleted() is called. | |
| 50 PepperPluginInstanceImpl* instance_; | |
| 51 | |
| 52 DISALLOW_COPY_AND_ASSIGN(PepperAudioController); | |
| 53 }; | |
| 54 | |
| 55 } // namespace content | |
| 56 | |
| 57 #endif // CONTENT_RENDERER_PEPPER_PEPPER_AUDIO_CONTROLLER_H_ | |
| OLD | NEW |