From 0b8692fc314bf905630c34822438018460ad010d Mon Sep 17 00:00:00 2001 From: twellington Date: Wed, 5 Aug 2015 14:07:16 -0700 Subject: [PATCH] Dismiss ContextualSearchPanel in TabModelObserver#didSelectTab BUG=498531 Review URL: https://codereview.chromium.org/1267373003 Cr-Commit-Position: refs/heads/master@{#341974} --- .../chrome/browser/contextualsearch/ContextualSearchManager.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java index f209dd60c701..8a62bc00342d 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java @@ -39,6 +39,7 @@ import org.chromium.chrome.browser.tab.TabRedirectHandler; import org.chromium.chrome.browser.tabmodel.EmptyTabModelObserver; import org.chromium.chrome.browser.tabmodel.TabModel; import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType; +import org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType; import org.chromium.chrome.browser.tabmodel.TabModelObserver; import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.tabmodel.TabModelSelectorTabObserver; @@ -216,6 +217,13 @@ public class ContextualSearchManager extends ContextualSearchObservable mTabModelObserver = new EmptyTabModelObserver() { @Override + public void didSelectTab(Tab tab, TabSelectionType type, int lastId) { + if (!mIsPromotingToTab && tab.getId() != lastId) { + hideContextualSearch(StateChangeReason.UNKNOWN); + } + } + + @Override public void didAddTab(Tab tab, TabLaunchType type) { // If we're in the process of promoting this tab, just return and don't mess with // this state. -- 2.11.4.GIT