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

Unified Diff: content/renderer/render_frame_impl.cc

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: moved start/stop/created/deleted to the follow-up CL 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
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_frame_impl.cc
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index c73b789cb8f00d00a90ce6b3407b47fca487437e..ca313fa8baff8a06bad8f20de0e7d7636354b57d 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -116,6 +116,7 @@
#include "content/renderer/navigation_state_impl.h"
#include "content/renderer/notification_permission_dispatcher.h"
#include "content/renderer/pepper/plugin_instance_throttler_impl.h"
+#include "content/renderer/pepper/ppb_audio_impl.h"
#include "content/renderer/presentation/presentation_dispatcher.h"
#include "content/renderer/push_messaging/push_messaging_dispatcher.h"
#include "content/renderer/render_frame_proxy.h"
@@ -1483,6 +1484,9 @@ bool RenderFrameImpl::OnMessageReceived(const IPC::Message& msg) {
IPC_MESSAGE_HANDLER(FrameMsg_ContextMenuClosed, OnContextMenuClosed)
IPC_MESSAGE_HANDLER(FrameMsg_CustomContextMenuAction,
OnCustomContextMenuAction)
+#if defined(ENABLE_PLUGINS)
+ IPC_MESSAGE_HANDLER(FrameMsg_SetPepperVolume, OnSetPepperVolume)
+#endif //defined(ENABLE_PLUGINS)
IPC_MESSAGE_HANDLER(InputMsg_Undo, OnUndo)
IPC_MESSAGE_HANDLER(InputMsg_Redo, OnRedo)
IPC_MESSAGE_HANDLER(InputMsg_Cut, OnCut)
@@ -6238,6 +6242,36 @@ void RenderFrameImpl::PepperFocusChanged(PepperPluginInstanceImpl* instance,
GetRenderWidget()->UpdateSelectionBounds();
}
+void RenderFrameImpl::PepperStartsPlayback(
+ PepperPluginInstanceImpl* instance, PPB_Audio_Impl* ppb_audio) {
+ // Only send start signal for the first PPB_Audio_Impl starts playback.
+ if (pepper_audios_map_[instance->pp_instance()].empty()) {
+ RenderFrameImpl* const render_frame = instance->render_frame();
+ // TODO(zqzhang): fire PepperStartsPlayback signal to the browser.
+ }
+ // TODO(zqzhang): it is unsure that whether a pepper instance can
+ // have multiple audio instances. Currently let the pepper instance
+ // delegates the SetVolume() method of all it's audio instances.
no sievers 2016/06/21 18:58:58 can you DCHECK() that it does not exist?
Zhiqiang Zhang (Slow) 2016/06/21 19:32:02 I think we should not trust Flash, so I added earl
+ pepper_audios_map_[instance->pp_instance()].insert(ppb_audio);
+}
+
+void RenderFrameImpl::PepperStopsPlayback(
+ PepperPluginInstanceImpl* instance, PPB_Audio_Impl* ppb_audio) {
+ pepper_audios_map_[instance->pp_instance()].erase(ppb_audio);
no sievers 2016/06/21 18:58:58 can you DCHECK() that it exists?
Zhiqiang Zhang (Slow) 2016/06/21 19:32:02 Ditto.
+
+ RenderFrameImpl* const render_frame = instance->render_frame();
+ // Only send stop signal for the last PPB_Audio_Impl stops playback.
+ if (render_frame && pepper_audios_map_[instance->pp_instance()].empty()) {
+ // TODO(zqzhang): fire PepperStopsPlayback signal to the browser.
+ }
+}
+
+void RenderFrameImpl::OnSetPepperVolume(int32_t pp_instance, double volume) {
+ if (pepper_audios_map_.count(pp_instance) == 0) return;
+ for (auto* ppb_audio : pepper_audios_map_[pp_instance]) {
+ ppb_audio->SetVolume(volume);
+ }
+}
#endif // ENABLE_PLUGINS
void RenderFrameImpl::RenderWidgetSetFocus(bool enable) {
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698