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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/document/DocumentUtils.java

Issue 2021913002: ✨ Minor cleanup of launching document tabs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nit. Created 4 years, 7 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/android/java/src/org/chromium/chrome/browser/document/DocumentUtils.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/document/DocumentUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/document/DocumentUtils.java
index a629b21461cfa7d18ebc3ff5966d20e843b5b462..6bbd9b06b016250b0a19ee55d595f718e4a79261 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/document/DocumentUtils.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/document/DocumentUtils.java
@@ -20,7 +20,6 @@ import android.util.Log;
import org.chromium.base.ContextUtils;
import org.chromium.chrome.browser.tab.Tab;
-import org.chromium.chrome.browser.tabmodel.document.ActivityDelegate;
import org.chromium.chrome.browser.tabmodel.document.DocumentTabModelImpl;
import java.util.ArrayList;
@@ -34,38 +33,6 @@ public class DocumentUtils {
public static final String TAG = "DocumentUtilities";
/**
- * Finishes tasks other than the one with the given task ID that were started with the given
- * tabId, leaving a unique task to own a Tab with that particular ID.
- * @param tabId ID of the tab to remove duplicates for.
- * @param canonicalTaskId ID of the task will be the only one left with the ID.
- * @return Intent of one of the tasks that were finished.
- */
- public static Intent finishOtherTasksWithTabID(int tabId, int canonicalTaskId) {
- if (tabId == Tab.INVALID_TAB_ID || Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
- return null;
- }
-
- Context context = ContextUtils.getApplicationContext();
-
- ActivityManager manager =
- (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
- List<ActivityManager.AppTask> tasksToFinish = new ArrayList<ActivityManager.AppTask>();
- for (ActivityManager.AppTask task : manager.getAppTasks()) {
- RecentTaskInfo taskInfo = getTaskInfoFromTask(task);
- if (taskInfo == null) continue;
- int taskId = taskInfo.id;
-
- Intent baseIntent = taskInfo.baseIntent;
- int otherTabId = ActivityDelegate.getTabIdFromIntent(baseIntent);
-
- if (otherTabId == tabId && (taskId == -1 || taskId != canonicalTaskId)) {
- tasksToFinish.add(task);
- }
- }
- return finishAndRemoveTasks(tasksToFinish);
- }
-
- /**
* Finishes tasks other than the one with the given ID that were started with the given data
* in the Intent, removing those tasks from Recents and leaving a unique task with the data.
* @param data Passed in as part of the Intent's data when starting the Activity.

Powered by Google App Engine
This is Rietveld 408576698