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

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

Issue 2281293002: Retain tab model selection during a multi-instance merge (Closed)
Patch Set: Created 4 years, 4 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/tabmodel/TabPersistentStore.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java
index 53cc679efa5e8810e0268f28fe7a388528ab37d8..8126adb8b952f402fd165c959ebad2db4b201168 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java
@@ -612,7 +612,16 @@ public class TabPersistentStore extends TabPersister {
// selected. TODO(twellington): The first tab will always be selected. Instead, the tab that
// was selected in the other model before the merge should be selected after the merge.
if (setAsActive || (tabToRestore.fromMerge && restoredIndex == 0)) {
+ boolean wasIncognitoTabModelSelected = mTabModelSelector.isIncognitoSelected();
TabModelUtils.setIndex(model, TabModelUtils.getTabIndexById(model, tabId));
+ boolean isIncognitoTabModelSelected = mTabModelSelector.isIncognitoSelected();
+
+ // Setting the index will cause the tab's model to be selected. Set it back to the model
+ // that was selected before setting the index if the index is being set during a merge.
+ if (tabToRestore.fromMerge
+ && wasIncognitoTabModelSelected != isIncognitoTabModelSelected) {
+ mTabModelSelector.selectModel(wasIncognitoTabModelSelected);
+ }
}
restoredTabs.put(tabToRestore.originalIndex, tabId);
}
« 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