Chromium Code Reviews| Index: content/renderer/pepper/pepper_audio_controller.h |
| diff --git a/content/renderer/pepper/pepper_audio_controller.h b/content/renderer/pepper/pepper_audio_controller.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5974626aa855acb3afa3993f4649b01f7548a774 |
| --- /dev/null |
| +++ b/content/renderer/pepper/pepper_audio_controller.h |
| @@ -0,0 +1,55 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_RENDERER_PEPPER_PEPPER_AUDIO_CONTROLLER_H_ |
| +#define CONTENT_RENDERER_PEPPER_PEPPER_AUDIO_CONTROLLER_H_ |
| + |
| +#include <set> |
| + |
| +#include "base/macros.h" |
| + |
| +namespace content { |
| + |
| +class PepperPluginInstanceImpl; |
| +class PPB_Audio_Impl; |
| + |
| +/** |
| + * Class for controlling all the active audio instances of a Pepper instance. |
| + * This class can only be a non-shareable member of PepperPluginInstanceImpl. |
| + */ |
|
mlamouri (slow - plz ping)
2016/06/23 13:04:13
style: we don't use /** comments. I think it shoul
Zhiqiang Zhang (Slow)
2016/06/23 14:50:29
Done.
|
| +class PepperAudioController { |
| + public: |
| + // Contructor of PepperAudioController. |
| + PepperAudioController(PepperPluginInstanceImpl* pepper_instance); |
|
mlamouri (slow - plz ping)
2016/06/23 13:04:13
add explicit.
Also, I don't think the comment is
Zhiqiang Zhang (Slow)
2016/06/23 14:50:29
Done.
|
| + // Destructor of PepperAudioController. |
|
mlamouri (slow - plz ping)
2016/06/23 13:04:13
ditto for the comment :)
Zhiqiang Zhang (Slow)
2016/06/23 14:50:29
Done.
|
| + virtual ~PepperAudioController(); |
| + |
| + // Adds an audio instance to the controller. |
| + void AddInstance(PPB_Audio_Impl* audio); |
| + // Removes an audio instance from the controller. |
| + void RemoveInstance(PPB_Audio_Impl* audio); |
| + // Sets the volume of all delegated audio resources. |
| + void SetVolume(double volume); |
| + // The pepper instance has been deleted. This method can only be called |
| + // once. The controller will be invalidated after this call, and then all |
| + // other methods will be no-op. |
| + void OnPepperInstanceDeleted(); |
| + |
| + private: |
| + // Notifies the RenderFrame that the playback has stopped. This method should |
| + // only be called when |ppb_audios_| turns from non-empty to empty. |
| + void NotifyPlaybackStopsOnEmpty(); |
| + |
| + // All active audio instances. |
| + std::set<PPB_Audio_Impl*> ppb_audios_; |
| + // The Pepper instance which this controller is for. Will be null after |
| + // OnPepperInstanceDeleted() is called. |
| + PepperPluginInstanceImpl* instance_; |
|
mlamouri (slow - plz ping)
2016/06/23 13:04:13
style: leave an empty line between two methods or
Zhiqiang Zhang (Slow)
2016/06/23 14:50:29
Done (and for all the methods above as well).
|
| + |
| + DISALLOW_COPY_AND_ASSIGN(PepperAudioController); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_RENDERER_PEPPER_PEPPER_AUDIO_CONTROLLER_H_ |