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

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 2551093002: Route Pepper MediaSession messages to frames (Closed)
Patch Set: nits Created 4 years 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/browser/web_contents/web_contents_impl.cc
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 51fc03d2be62dd41a25388af0c52bcea3f76d1e4..89325e925f5bf6e909d342f314fb8d9023dcbd74 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -738,15 +738,7 @@ bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host,
IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed)
IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnWebUISend)
#if BUILDFLAG(ENABLE_PLUGINS)
- IPC_MESSAGE_HANDLER(FrameHostMsg_PepperInstanceCreated,
- OnPepperInstanceCreated)
- IPC_MESSAGE_HANDLER(FrameHostMsg_PepperInstanceDeleted,
- OnPepperInstanceDeleted)
IPC_MESSAGE_HANDLER(FrameHostMsg_PepperPluginHung, OnPepperPluginHung)
- IPC_MESSAGE_HANDLER(FrameHostMsg_PepperStartsPlayback,
- OnPepperStartsPlayback)
- IPC_MESSAGE_HANDLER(FrameHostMsg_PepperStopsPlayback,
- OnPepperStopsPlayback)
IPC_MESSAGE_HANDLER(FrameHostMsg_PluginCrashed, OnPluginCrashed)
IPC_MESSAGE_HANDLER(ViewHostMsg_RequestPpapiBrokerPermission,
OnRequestPpapiBrokerPermission)
@@ -771,6 +763,27 @@ bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host,
#endif
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
+
+#if BUILDFLAG(ENABLE_PLUGINS)
+ if (render_frame_host && !handled) {
+ handled = true;
+ // Maps for messages that need to be handled with |render_frame_host| as a
+ // parameter
+ IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(WebContentsImpl, message,
whywhat 2016/12/06 01:37:31 nit: change WebContentsImpl to RenderFrameHostImpl
Zhiqiang Zhang (Slow) 2016/12/06 12:05:56 No longer applicable, this change is reverted.
+ render_frame_host)
+ IPC_MESSAGE_HANDLER(FrameHostMsg_PepperInstanceCreated,
+ OnPepperInstanceCreated)
+ IPC_MESSAGE_HANDLER(FrameHostMsg_PepperInstanceDeleted,
+ OnPepperInstanceDeleted)
+ IPC_MESSAGE_HANDLER(FrameHostMsg_PepperStartsPlayback,
+ OnPepperStartsPlayback)
+ IPC_MESSAGE_HANDLER(FrameHostMsg_PepperStopsPlayback,
+ OnPepperStopsPlayback)
+ IPC_MESSAGE_UNHANDLED(handled = false)
+ IPC_END_MESSAGE_MAP()
+ }
+#endif // BUILDFLAG(ENABLE_PLUGINS)
+
render_view_message_source_ = NULL;
render_frame_message_source_ = NULL;
@@ -3757,16 +3770,20 @@ void WebContentsImpl::OnWebUISend(const GURL& source_url,
}
#if BUILDFLAG(ENABLE_PLUGINS)
-void WebContentsImpl::OnPepperInstanceCreated(int32_t pp_instance) {
+void WebContentsImpl::OnPepperInstanceCreated(
+ RenderFrameHost* render_frame_host, int32_t pp_instance) {
for (auto& observer : observers_)
observer.PepperInstanceCreated();
- pepper_playback_observer_->PepperInstanceCreated(pp_instance);
+ pepper_playback_observer_->PepperInstanceCreated(
+ render_frame_host, pp_instance);
whywhat 2016/12/06 01:37:31 Hm, it seems like you don't need to change the map
Zhiqiang Zhang (Slow) 2016/12/06 12:05:56 Didn't realize that. Thanks for pointing out. Done
}
-void WebContentsImpl::OnPepperInstanceDeleted(int32_t pp_instance) {
+void WebContentsImpl::OnPepperInstanceDeleted(
+ RenderFrameHost* render_frame_host, int32_t pp_instance) {
for (auto& observer : observers_)
observer.PepperInstanceDeleted();
- pepper_playback_observer_->PepperInstanceDeleted(pp_instance);
+ pepper_playback_observer_->PepperInstanceDeleted(
+ render_frame_host, pp_instance);
}
void WebContentsImpl::OnPepperPluginHung(int plugin_child_id,
@@ -3778,12 +3795,16 @@ void WebContentsImpl::OnPepperPluginHung(int plugin_child_id,
observer.PluginHungStatusChanged(plugin_child_id, path, is_hung);
}
-void WebContentsImpl::OnPepperStartsPlayback(int32_t pp_instance) {
- pepper_playback_observer_->PepperStartsPlayback(pp_instance);
+void WebContentsImpl::OnPepperStartsPlayback(
+ RenderFrameHost* render_frame_host, int32_t pp_instance) {
+ pepper_playback_observer_->PepperStartsPlayback(
+ render_frame_host, pp_instance);
}
-void WebContentsImpl::OnPepperStopsPlayback(int32_t pp_instance) {
- pepper_playback_observer_->PepperStopsPlayback(pp_instance);
+void WebContentsImpl::OnPepperStopsPlayback(
+ RenderFrameHost* render_frame_host, int32_t pp_instance) {
+ pepper_playback_observer_->PepperStopsPlayback(
+ render_frame_host, pp_instance);
}
void WebContentsImpl::OnPluginCrashed(const base::FilePath& plugin_path,

Powered by Google App Engine
This is Rietveld 408576698