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

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

Issue 493253002: [Android] Stop all media on undoable close. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added comment Created 6 years, 4 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_android.cc
diff --git a/content/browser/web_contents/web_contents_android.cc b/content/browser/web_contents/web_contents_android.cc
index 26a70110b57363a81c24b59c6d95af7eda5d66f5..23f47f77a1be8071d10fb35c2c93050b1854beeb 100644
--- a/content/browser/web_contents/web_contents_android.cc
+++ b/content/browser/web_contents/web_contents_android.cc
@@ -11,6 +11,7 @@
#include "base/logging.h"
#include "content/browser/android/interstitial_page_delegate_android.h"
#include "content/browser/frame_host/interstitial_page_impl.h"
+#include "content/browser/media/android/browser_media_player_manager.h"
#include "content/browser/media/media_web_contents_observer.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/web_contents/web_contents_impl.h"
@@ -184,6 +185,20 @@ void WebContentsAndroid::OnShow(JNIEnv* env, jobject obj) {
web_contents_->WasShown();
}
+void WebContentsAndroid::ReleaseMediaPlayers(JNIEnv* env, jobject jobj) {
+ RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>(
+ web_contents_->GetRenderViewHost());
qinmin 2014/08/25 18:57:12 nit: -2 indent
David Trainor- moved to gerrit 2014/08/25 23:42:15 Done.
+#if defined(ENABLE_BROWSER_CDMS)
+ if (rvhi && rvhi->GetMainFrame()) {
qinmin 2014/08/25 18:57:12 nit: nested if statements. Consider rewriting: if
David Trainor- moved to gerrit 2014/08/25 23:42:15 Done.
+ BrowserMediaPlayerManager* manager =
+ rvhi->media_web_contents_observer()->GetMediaPlayerManager(
+ rvhi->GetMainFrame());
+ if (manager)
+ manager->ReleaseAllMediaPlayers();
+ }
+#endif // defined(ENABLE_BROWSER_CDMS)
+}
+
void WebContentsAndroid::PauseVideo() {
RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>(
web_contents_->GetRenderViewHost());

Powered by Google App Engine
This is Rietveld 408576698