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

Side by Side Diff: content/renderer/pepper/pepper_audio_controller.h

Issue 2065513004: Expose flash playback status and volume control to content renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@audio_focus_manager
Patch Set: addressing nits Created 4 years, 5 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
(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 audio instances.
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698