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 5d620f9e6cb8e1d6b52c4302d6b310feddc2fa51..5c995a09faab4740647b13d9f04c5c26545ac27b 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java |
@@ -51,6 +51,7 @@ import org.chromium.chrome.browser.IntentHandler.IntentHandlerDelegate; |
import org.chromium.chrome.browser.IntentHandler.TabOpenType; |
import org.chromium.chrome.browser.appmenu.AppMenuPropertiesDelegate; |
import org.chromium.chrome.browser.bookmarks.BookmarkUtils; |
+import org.chromium.chrome.browser.browseractions.BrowserActionsContextMenuItemDelegate; |
import org.chromium.chrome.browser.compositor.CompositorViewHolder; |
import org.chromium.chrome.browser.compositor.bottombar.OverlayPanel.StateChangeReason; |
import org.chromium.chrome.browser.compositor.layouts.Layout; |
@@ -588,8 +589,8 @@ public class ChromeTabbedActivity extends ChromeActivity implements OverviewMode |
@Override |
public void onStartWithNative() { |
super.onStartWithNative(); |
- // If we don't have a current tab, show the overview mode. |
- if (getActivityTab() == null) mLayoutManager.showOverview(false); |
+ setInitialOverviewState(); |
+ BrowserActionsContextMenuItemDelegate.cancelBrowserActionsNotification(); |
resetSavedInstanceState(); |
} |
@@ -643,6 +644,30 @@ public class ChromeTabbedActivity extends ChromeActivity implements OverviewMode |
} |
} |
+ private boolean isStartedByBrowserActions() { |
Yusuf
2017/05/30 17:57:15
would look much nicer if this was a static in Brow
ltian
2017/05/30 19:19:49
Done.
|
+ if (BrowserActionsContextMenuItemDelegate.ACTION_BROWSER_ACTIONS_OPEN_IN_BACKGROUND.equals( |
+ getIntent().getAction())) { |
+ return true; |
+ } |
+ return false; |
+ } |
+ |
+ private void setInitialOverviewState() { |
+ boolean isOverviewVisible = mLayoutManager.overviewVisible(); |
+ if (getActivityTab() == null && !isOverviewVisible) { |
+ toggleOverview(); |
+ } |
+ |
+ boolean fromBrowserActions = isStartedByBrowserActions(); |
+ boolean isSingleUrl = IntentUtils.safeGetBooleanExtra( |
+ getIntent(), BrowserActionsContextMenuItemDelegate.EXTRA_IS_SINGLE_URL, false); |
+ if (fromBrowserActions) { |
+ if (isSingleUrl == isOverviewVisible) { |
Yusuf
2017/05/30 17:57:15
all this logic is specific to BrowserActions and s
ltian
2017/05/30 19:19:49
Done.
|
+ toggleOverview(); |
+ } |
+ } |
+ } |
+ |
private void initializeUI() { |
try { |
TraceEvent.begin("ChromeTabbedActivity.initializeUI"); |
@@ -1783,6 +1808,11 @@ public class ChromeTabbedActivity extends ChromeActivity implements OverviewMode |
private void toggleOverview() { |
Tab currentTab = getActivityTab(); |
+ // If we don't have a current tab, show the overview mode. |
+ if (currentTab == null) { |
+ mLayoutManager.showOverview(false); |
+ return; |
+ } |
ContentViewCore contentViewCore = |
currentTab != null ? currentTab.getContentViewCore() : null; |