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_CONTROL_DELEGATE_H_ | |
| 6 #define CONTENT_RENDERER_PEPPER_PEPPER_AUDIO_CONTROL_DELEGATE_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 * Class for delegating audio controls of a Pepper instance to all it's active | |
| 19 * audios. This class can only be a non-sharable member of | |
| 20 * PepperPluginInstanceImpl. | |
|
bbudge
2016/06/22 18:14:55
nits: s/it's/its
s/audios/audio resources
s/shar
Zhiqiang Zhang (Slow)
2016/06/22 21:00:42
Done.
| |
| 21 */ | |
| 22 class PepperAudioControlDelegate { | |
|
bbudge
2016/06/22 18:14:55
This class seems more like a tracker / controller.
Zhiqiang Zhang (Slow)
2016/06/22 21:00:42
Done.
| |
| 23 public: | |
| 24 // Contructor of PepperAudioControlDelegate. | |
| 25 PepperAudioControlDelegate(PepperPluginInstanceImpl* pepper_instance); | |
| 26 // Destructor of PepperAudioControlDelegate, OnPepperInstanceDeleted() should | |
| 27 // be called before calling destructor. | |
|
bbudge
2016/06/22 18:14:55
Instead of leaving it up to the client, why not au
Zhiqiang Zhang (Slow)
2016/06/22 21:00:43
Done.
| |
| 28 virtual ~PepperAudioControlDelegate(); | |
| 29 | |
| 30 // An audio instance has started playback. | |
|
bbudge
2016/06/22 18:14:55
Comments should tell what method does, e.g.
// Ad
Zhiqiang Zhang (Slow)
2016/06/22 21:00:42
Done.
| |
| 31 void AddActiveAudioInstance(PPB_Audio_Impl* audio); | |
|
bbudge
2016/06/22 18:14:55
s/AddActiveAudioInstance/AddInstance should be eno
Zhiqiang Zhang (Slow)
2016/06/22 21:00:43
Done.
| |
| 32 // An audio instance has stopped playback. | |
| 33 void RemoveActiveAudioInstance(PPB_Audio_Impl* audio); | |
| 34 // Sets the volume of all delegated audios. | |
|
bbudge
2016/06/22 18:14:55
s/audios/audio resources
Otherwise, comment is goo
Zhiqiang Zhang (Slow)
2016/06/22 21:00:42
Done.
| |
| 35 void SetVolume(double volume); | |
| 36 // The pepper instance has been deleted. This method can only be called | |
| 37 // once. The delegate will be invalidated after this call, and then all other | |
| 38 // methods will be no-op. | |
| 39 void OnPepperInstanceDeleted(); | |
| 40 | |
| 41 private: | |
| 42 // All active audio instances. | |
| 43 std::set<PPB_Audio_Impl*> ppb_audios_; | |
| 44 // The Pepper instance which this delegate is for. Will be null after | |
| 45 // OnPepperInstanceDeleted() is called. | |
| 46 PepperPluginInstanceImpl* pepper_instance_; | |
|
bbudge
2016/06/22 18:14:55
s/pepper_instance_/instance_
Pepper should be obv
Zhiqiang Zhang (Slow)
2016/06/22 21:00:42
Done.
| |
| 47 | |
| 48 DISALLOW_COPY_AND_ASSIGN(PepperAudioControlDelegate); | |
| 49 }; | |
| 50 | |
| 51 } | |
| 52 | |
| 53 #endif // CONTENT_RENDERER_PEPPER_PEPPER_AUDIO_CONTROL_DELEGATE_H_ | |
| OLD | NEW |