Chromium Code Reviews| 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..a7a25ab010d92101a9ccd686d9afdcfab61decb9 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,35 @@ void ChromeWebContentsDelegateAndroid::AddNewContents( |
| delete new_contents; |
| } |
| + |
| +void ChromeWebContentsDelegateAndroid::ShowMediaControls( |
| + 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_paused = delegate->IsPaused(); |
|
mlamouri (slow - plz ping)
2015/06/18 16:43:22
If I understand correctly, the only reason why you
whywhat
2015/06/19 16:00:34
So why would you want to split Show and Update?
Th
mlamouri (slow - plz ping)
2015/06/22 14:34:17
What would you think of having UpdateMediaControls
whywhat
2015/06/23 19:39:10
Per offline discussion we agreed that there're two
|
| + Java_ChromeWebContentsDelegateAndroid_showMediaControls( |
| + env, obj.obj(), jis_paused); |
| +} |
| + |
| +void ChromeWebContentsDelegateAndroid::HideMediaControls( |
| + WebContents* web_contents) { |
| + DCHECK(web_contents); |
| + |
| + JNIEnv* env = AttachCurrentThread(); |
| + ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); |
| + if (obj.is_null()) |
| + return; |
| + |
| + Java_ChromeWebContentsDelegateAndroid_hideMediaControls(env, obj.obj()); |
| +} |
| + |
| } // namespace android |
| } // namespace chrome |
| @@ -384,3 +414,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(); |
| +} |