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

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

Issue 1039513003: Make DocumentTabModelImpl fire didSelectTab (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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/tabmodel/document/DocumentTabModelImpl.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/document/DocumentTabModelImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/document/DocumentTabModelImpl.java
index 620147f77108cc045986dd6e1db514167af885dd..a0ab26789c764cc970abe3b303dcca96a76b88d9 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/document/DocumentTabModelImpl.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/document/DocumentTabModelImpl.java
@@ -223,7 +223,10 @@ public class DocumentTabModelImpl extends TabModelJniBridge implements DocumentT
}
@Override
- public void setLastShownId(int id) {
+ public boolean setLastShownId(int id) {
+ if (mLastShownTabId == id) return false;
+
+ int previousTabId = mLastShownTabId;
mLastShownTabId = id;
String prefName =
@@ -232,6 +235,15 @@ public class DocumentTabModelImpl extends TabModelJniBridge implements DocumentT
SharedPreferences.Editor editor = prefs.edit();
editor.putInt(prefName, id);
editor.apply();
+
+ // TODO(dfalcantara): Figure out how to fire the correct type of TabSelectionType, which is
+ // quite hard to do in Document-mode from where we call this.
+ for (TabModelObserver obs : mObservers) {
+ obs.didSelectTab(
+ TabModelUtils.getCurrentTab(this), TabSelectionType.FROM_USER, previousTabId);
+ }
+
+ return true;
}
@Override

Powered by Google App Engine
This is Rietveld 408576698