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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java

Issue 1328663003: [Custom tab]Fix a bug that clicking media notification opens blank tab (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: final touch Created 5 years, 3 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
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/media/ui/NotificationMediaPlaybackControls.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java
index 9f2b7daf463b28f2dd3c1bee1982bbfc9d878fdc..67f0e5b6558ee4a6b681fb92be9ff94a7f705b05 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java
@@ -50,6 +50,7 @@ import org.chromium.chrome.browser.contextmenu.ContextMenuParams;
import org.chromium.chrome.browser.contextmenu.ContextMenuPopulator;
import org.chromium.chrome.browser.contextmenu.ContextMenuPopulatorWrapper;
import org.chromium.chrome.browser.contextmenu.EmptyChromeContextMenuItemDelegate;
+import org.chromium.chrome.browser.customtabs.CustomTabActivity;
import org.chromium.chrome.browser.fullscreen.FullscreenManager;
import org.chromium.chrome.browser.help.HelpAndFeedback;
import org.chromium.chrome.browser.infobar.InfoBarContainer;
@@ -86,6 +87,7 @@ import org.chromium.ui.base.PageTransition;
import org.chromium.ui.base.WindowAndroid;
import org.chromium.ui.gfx.DeviceDisplayInfo;
+import java.lang.ref.WeakReference;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
@@ -2842,9 +2844,21 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener,
}
/**
- * Returns an Intent that tells Chrome to open a Tab with a particular ID.
+ * @return Intent that tells Chrome to bring an Activity for a particular Tab back to the
+ * foreground, or null if this isn't possible.
*/
public static Intent createBringTabToFrontIntent(int tabId) {
+ // Iterate through all {@link CustomTab}s and check whether the given tabId belongs to a
+ // {@link CustomTab}. If so, return null as the client app's task cannot be foregrounded.
+ List<WeakReference<Activity>> list = ApplicationStatus.getRunningActivities();
+ for (WeakReference<Activity> ref : list) {
+ Activity activity = ref.get();
+ if (activity instanceof CustomTabActivity
+ && tabId == ((CustomTabActivity) activity).getActivityTab().getId()) {
+ return null;
+ }
+ }
+
String packageName = ApplicationStatus.getApplicationContext().getPackageName();
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.putExtra(Browser.EXTRA_APPLICATION_ID, packageName);
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/media/ui/NotificationMediaPlaybackControls.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698