Chromium Code Reviews| 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) { |