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(); |
+} |