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..37db7073443d2da82750f611efbe3c40a05eaed8 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() { |
+ 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) || (!isSingleUrl && !isOverviewVisible)) { |
David Trainor- moved to gerrit
2017/05/25 17:23:28
Is this the same as "if (isSingleUrl == isOverview
ltian
2017/05/26 18:12:58
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; |