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

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

Issue 2448433003: Finish ChromeTabbedActivity if its tabs have been merged into another instance (Closed)
Patch Set: Remove extra blank lines Created 4 years, 2 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 | « no previous file | 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/ChromeTabbedActivity.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
index b1bafafddc97e1a2999df62c3d5430a6dbe55f7a..3193d1fc0170d7c5ee4fd560360a11eedd7d1436 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
@@ -186,6 +186,9 @@ public class ChromeTabbedActivity extends ChromeActivity implements OverviewMode
private static final String ACTION_CLOSE_TABS =
"com.google.android.apps.chrome.ACTION_CLOSE_TABS";
+ /** The task id of the activity that tabs were merged into. */
+ private static int sMergedInstanceTaskId;
+
private final ActivityStopMetrics mActivityStopMetrics = new ActivityStopMetrics();
private FindToolbarManager mFindToolbarManager;
@@ -1093,6 +1096,14 @@ public class ChromeTabbedActivity extends ChromeActivity implements OverviewMode
}
@Override
+ protected boolean isStartedUpCorrectly(Intent intent) {
+ // If tabs were merged into a different ChromeTabbedActivity instance, then this
gone 2016/10/25 18:33:10 If tabs from this instance?
Theresa 2016/10/25 18:57:40 Done.
+ // instance should not be created. This may happen if the process is restarted
+ // e.g. on upgrade or from about://flags. See crbug.com/657418
+ return sMergedInstanceTaskId == 0 || sMergedInstanceTaskId == getTaskId();
gone 2016/10/25 18:33:10 I'm worried about cases where the user can't get b
Theresa 2016/10/25 18:57:40 Done.
+ }
+
+ @Override
public void terminateIncognitoSession() {
getTabModelSelector().getModel(true).closeAllTabs();
}
@@ -1197,6 +1208,8 @@ public class ChromeTabbedActivity extends ChromeActivity implements OverviewMode
MultiWindowUtils.getInstance().getOpenInOtherWindowActivity(this);
if (targetActivity == null) return;
+ // When a second instance is created, the merged instance task id should be cleared.
+ setMergedInstanceTaskId(0);
Intent intent = new Intent(this, targetActivity);
MultiWindowUtils.setOpenInOtherWindowIntentExtras(intent, this, targetActivity);
@@ -1616,6 +1629,8 @@ public class ChromeTabbedActivity extends ChromeActivity implements OverviewMode
// 4. Ask TabPersistentStore to merge state.
RecordUserAction.record("Android.MergeState.Live");
mTabModelSelectorImpl.mergeState();
+
+ setMergedInstanceTaskId(getTaskId());
}
/**
@@ -1662,4 +1677,8 @@ public class ChromeTabbedActivity extends ChromeActivity implements OverviewMode
(ToolbarControlContainer) findViewById(R.id.control_container),
getTabModelSelector(), getControlContainerHeightResource(), true);
}
+
+ private static void setMergedInstanceTaskId(int mergedInstanceTaskId) {
+ sMergedInstanceTaskId = mergedInstanceTaskId;
+ }
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698