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

Unified Diff: chrome/browser/android/chrome_web_contents_delegate_android.cc

Issue 1159113006: [Android] A prototype of the interactive media notification. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed tests and Min's nits Created 5 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: chrome/browser/android/chrome_web_contents_delegate_android.cc
diff --git a/chrome/browser/android/chrome_web_contents_delegate_android.cc b/chrome/browser/android/chrome_web_contents_delegate_android.cc
index 7867ae17c1060cff6fe50d4955f6674dbd051156..cb75ad72b4832dccb626df3a83480fa170d0c61b 100644
--- a/chrome/browser/android/chrome_web_contents_delegate_android.cc
+++ b/chrome/browser/android/chrome_web_contents_delegate_android.cc
@@ -24,6 +24,7 @@
#include "chrome/browser/ui/tab_helpers.h"
#include "chrome/common/chrome_switches.h"
#include "components/app_modal/javascript_dialog_manager.h"
+#include "content/public/browser/android/media_controls_delegate.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_source.h"
@@ -352,6 +353,24 @@ void ChromeWebContentsDelegateAndroid::AddNewContents(
delete new_contents;
}
+
+void ChromeWebContentsDelegateAndroid::UpdateMediaControls(
+ WebContents* web_contents) {
+ DCHECK(web_contents);
+
+ JNIEnv* env = AttachCurrentThread();
+ ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
+ if (obj.is_null())
+ return;
+
+ content::MediaControlsDelegate* delegate =
+ web_contents->GetMediaControlsDelegate();
+ jboolean jis_controllable = delegate->IsControllable();
+ jboolean jis_paused = delegate->IsPaused();
+ Java_ChromeWebContentsDelegateAndroid_updateMediaControls(
+ env, obj.obj(), jis_controllable, jis_paused);
+}
+
} // namespace android
} // namespace chrome
@@ -384,3 +403,23 @@ jboolean HasAudibleAudio(JNIEnv* env,
content::WebContents::FromJavaWebContents(java_web_contents);
return web_contents->WasRecentlyAudible();
}
+
+void OnMediaControlsPause(
+ JNIEnv* env, jclass clazz, jobject java_web_contents) {
+ content::WebContents* web_contents =
+ content::WebContents::FromJavaWebContents(java_web_contents);
+ content::MediaControlsDelegate* delegate =
+ web_contents->GetMediaControlsDelegate();
+ if (delegate)
+ delegate->OnControlsPause();
+}
+
+void OnMediaControlsResume(
+ JNIEnv* env, jclass clazz, jobject java_web_contents) {
+ content::WebContents* web_contents =
+ content::WebContents::FromJavaWebContents(java_web_contents);
+ content::MediaControlsDelegate* delegate =
+ web_contents->GetMediaControlsDelegate();
+ if (delegate)
+ delegate->OnControlsResume();
+}

Powered by Google App Engine
This is Rietveld 408576698