Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/tab/TabWebContentsDelegateAndroid.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabWebContentsDelegateAndroid.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabWebContentsDelegateAndroid.java |
| index c99d98f24b48bb72ca3e6895a25bfef2885ab331..cb36709f05dc1cf167911e3c0624e0b929010698 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabWebContentsDelegateAndroid.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabWebContentsDelegateAndroid.java |
| @@ -36,6 +36,7 @@ import org.chromium.chrome.browser.tabmodel.TabCreatorManager.TabCreator; |
| import org.chromium.chrome.browser.tabmodel.TabModel; |
| import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType; |
| import org.chromium.chrome.browser.tabmodel.TabModelUtils; |
| +import org.chromium.chrome.browser.tabmodel.TabWindowManager; |
| import org.chromium.chrome.browser.util.FeatureUtilities; |
| import org.chromium.components.web_contents_delegate_android.WebContentsDelegateAndroid; |
| import org.chromium.content_public.browser.InvalidateTypes; |
| @@ -74,6 +75,7 @@ public class TabWebContentsDelegateAndroid extends WebContentsDelegateAndroid { |
| private int mDisplayMode = WebDisplayMode.Browser; |
| protected Handler mHandler; |
| + |
| private final Runnable mCloseContentsRunnable = new Runnable() { |
| @Override |
| public void run() { |
| @@ -226,9 +228,10 @@ public class TabWebContentsDelegateAndroid extends WebContentsDelegateAndroid { |
| @Override |
| public void navigationStateChanged(int flags) { |
| if ((flags & InvalidateTypes.TAB) != 0) { |
| + int mediaType = MediaCaptureNotificationService.getMediaType( |
| + isCapturingAudio(), isCapturingVideo(), isCapturingScreen()); |
| MediaCaptureNotificationService.updateMediaNotificationForTab( |
| - mTab.getApplicationContext(), mTab.getId(), isCapturingAudio(), |
| - isCapturingVideo(), mTab.getUrl()); |
| + mTab.getApplicationContext(), mTab.getId(), mediaType, mTab.getUrl()); |
| } |
| if ((flags & InvalidateTypes.TITLE) != 0) { |
| // Update cached title then notify observers. |
| @@ -475,8 +478,26 @@ public class TabWebContentsDelegateAndroid extends WebContentsDelegateAndroid { |
| return !mTab.isClosing() && nativeIsCapturingVideo(mTab.getWebContents()); |
| } |
| + /** |
| + * @return Whether screen is being captured. |
| + */ |
| + private boolean isCapturingScreen() { |
| + return !mTab.isClosing() && nativeIsCapturingScreen(mTab.getWebContents()); |
| + } |
| + |
| + /** |
| + * When STOP button in the media capture notification is clicked, pass the event to native |
| + * to stop the media capture. |
| + */ |
|
braveyao
2016/08/12 23:37:44
Done
|
| + public static void notifyStopped(int tabId) { |
| + final Tab tab = TabWindowManager.getInstance().getTabById(tabId); |
| + if (tab != null) nativeNotifyStopped(tab.getWebContents()); |
| + } |
| + |
| private static native void nativeOnRendererUnresponsive(WebContents webContents); |
| private static native void nativeOnRendererResponsive(WebContents webContents); |
| private static native boolean nativeIsCapturingAudio(WebContents webContents); |
| private static native boolean nativeIsCapturingVideo(WebContents webContents); |
| + private static native boolean nativeIsCapturingScreen(WebContents webContents); |
| + private static native void nativeNotifyStopped(WebContents webContents); |
| } |