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

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

Issue 2060933002: Let Flash join and be controlled by media session (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pepper_to_contents
Patch Set: addressed Jochen's comments 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/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 2978fb9e1c1e386f7eec5be92e6fee02b2192435..8937359bac4a5f94b815fa0774d444fab445e39a 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -10,6 +10,7 @@
#include <utility>
#include "base/command_line.h"
+#include "base/feature_list.h"
#include "base/lazy_instance.h"
#include "base/location.h"
#include "base/logging.h"
@@ -143,6 +144,10 @@
#include "ui/aura/mus/mus_util.h"
#endif
+#if defined(ENABLE_PLUGINS)
+#include "content/browser/media/session/pepper_playback_observer.h"
+#endif // ENABLE_PLUGINS
+
namespace content {
namespace {
@@ -427,6 +432,9 @@ WebContentsImpl::WebContentsImpl(BrowserContext* browser_context)
#else
media_web_contents_observer_.reset(new MediaWebContentsObserver(this));
#endif
+#if defined (ENABLE_PLUGINS)
+ pepper_playback_observer_.reset(new PepperPlaybackObserver(this));
+#endif
loader_io_thread_notifier_.reset(new LoaderIOThreadNotifier(this));
wake_lock_service_context_.reset(new WakeLockServiceContext(this));
}
@@ -493,6 +501,12 @@ WebContentsImpl::~WebContentsImpl() {
}
}
+#if defined(ENABLE_PLUGINS)
+ // Call this before WebContentsDestroyed() is broadcasted since
+ // AudioFocusManager will be destroyed after that.
+ pepper_playback_observer_.reset();
+#endif // defined(ENABLED_PLUGINS)
+
FOR_EACH_OBSERVER(WebContentsObserver, observers_,
FrameDeleted(root->current_frame_host()));
@@ -688,6 +702,10 @@ bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host,
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)
@@ -3699,12 +3717,16 @@ void WebContentsImpl::OnWebUISend(const GURL& source_url,
}
#if defined(ENABLE_PLUGINS)
-void WebContentsImpl::OnPepperInstanceCreated() {
- FOR_EACH_OBSERVER(WebContentsObserver, observers_, PepperInstanceCreated());
+void WebContentsImpl::OnPepperInstanceCreated(int32_t pp_instance) {
+ FOR_EACH_OBSERVER(WebContentsObserver, observers_,
+ PepperInstanceCreated());
+ pepper_playback_observer_->PepperInstanceCreated(pp_instance);
}
-void WebContentsImpl::OnPepperInstanceDeleted() {
- FOR_EACH_OBSERVER(WebContentsObserver, observers_, PepperInstanceDeleted());
+void WebContentsImpl::OnPepperInstanceDeleted(int32_t pp_instance) {
+ FOR_EACH_OBSERVER(WebContentsObserver, observers_,
+ PepperInstanceDeleted());
+ pepper_playback_observer_->PepperInstanceDeleted(pp_instance);
}
void WebContentsImpl::OnPepperPluginHung(int plugin_child_id,
@@ -3716,6 +3738,14 @@ void WebContentsImpl::OnPepperPluginHung(int plugin_child_id,
PluginHungStatusChanged(plugin_child_id, path, is_hung));
}
+void WebContentsImpl::OnPepperStartsPlayback(int32_t pp_instance) {
+ pepper_playback_observer_->PepperStartsPlayback(pp_instance);
+}
+
+void WebContentsImpl::OnPepperStopsPlayback(int32_t pp_instance) {
+ pepper_playback_observer_->PepperStopsPlayback(pp_instance);
+}
+
void WebContentsImpl::OnPluginCrashed(const base::FilePath& plugin_path,
base::ProcessId plugin_pid) {
FOR_EACH_OBSERVER(WebContentsObserver, observers_,

Powered by Google App Engine
This is Rietveld 408576698