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

Unified Diff: content/renderer/pepper/pepper_audio_control_delegate.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: moving audio delegate to pepper Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/pepper/pepper_audio_control_delegate.h
diff --git a/content/renderer/pepper/pepper_audio_control_delegate.h b/content/renderer/pepper/pepper_audio_control_delegate.h
new file mode 100644
index 0000000000000000000000000000000000000000..749fccd7ecc93874765ef8ea90af85834789eb68
--- /dev/null
+++ b/content/renderer/pepper/pepper_audio_control_delegate.h
@@ -0,0 +1,53 @@
+// 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_CONTROL_DELEGATE_H_
+#define CONTENT_RENDERER_PEPPER_PEPPER_AUDIO_CONTROL_DELEGATE_H_
+
+#include <set>
+
+#include "base/macros.h"
+
+namespace content {
+
+class PepperPluginInstanceImpl;
+class PPB_Audio_Impl;
+
+/**
+ * Class for delegating audio controls of a Pepper instance to all it's active
+ * audios. This class can only be a non-sharable member of
+ * 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.
+ */
+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.
+ public:
+ // Contructor of PepperAudioControlDelegate.
+ PepperAudioControlDelegate(PepperPluginInstanceImpl* pepper_instance);
+ // Destructor of PepperAudioControlDelegate, OnPepperInstanceDeleted() should
+ // 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.
+ virtual ~PepperAudioControlDelegate();
+
+ // 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.
+ 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.
+ // An audio instance has stopped playback.
+ void RemoveActiveAudioInstance(PPB_Audio_Impl* audio);
+ // 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.
+ void SetVolume(double volume);
+ // The pepper instance has been deleted. This method can only be called
+ // once. The delegate will be invalidated after this call, and then all other
+ // methods will be no-op.
+ void OnPepperInstanceDeleted();
+
+ private:
+ // All active audio instances.
+ std::set<PPB_Audio_Impl*> ppb_audios_;
+ // The Pepper instance which this delegate is for. Will be null after
+ // OnPepperInstanceDeleted() is called.
+ 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.
+
+ DISALLOW_COPY_AND_ASSIGN(PepperAudioControlDelegate);
+};
+
+}
+
+#endif // CONTENT_RENDERER_PEPPER_PEPPER_AUDIO_CONTROL_DELEGATE_H_

Powered by Google App Engine
This is Rietveld 408576698