Chromium Code Reviews| 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 3d69ef7f66a118ac66550c86911609f8bef2e70a..15c739d92464f93d5bce76a49da1880e3c81b8be 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; |
| @@ -589,7 +590,10 @@ public class ChromeTabbedActivity extends ChromeActivity implements OverviewMode |
| public void onStartWithNative() { |
| super.onStartWithNative(); |
| // If we don't have a current tab, show the overview mode. |
| - if (getActivityTab() == null) mLayoutManager.showOverview(false); |
| + if (setInitialOverviewState()) { |
|
David Trainor- moved to gerrit
2017/05/23 06:16:43
set -> Should just set. No need to return anythin
ltian
2017/05/23 18:36:46
Done.
|
| + toggleOverview(); |
| + } |
| + BrowserActionsContextMenuItemDelegate.cancelBrowserActionsNotification(); |
| resetSavedInstanceState(); |
| } |
| @@ -643,6 +647,33 @@ 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 boolean setInitialOverviewState() { |
| + boolean isOverviewVisible = mLayoutManager.overviewVisible(); |
| + if (getActivityTab() == null && !isOverviewVisible) { |
| + return true; |
| + } |
| + |
| + boolean fromBrowserActions = isStartedByBrowserActions(); |
| + boolean isSingleUrl = IntentUtils.safeGetBooleanExtra( |
| + getIntent(), BrowserActionsContextMenuItemDelegate.EXTRA_IS_SINGLE_URL, false); |
| + if (fromBrowserActions) { |
| + if (isSingleUrl && isOverviewVisible) { |
| + return true; |
| + } else if (!isSingleUrl && !isOverviewVisible) { |
| + return true; |
| + } |
| + } |
| + return false; |
| + } |
| + |
| private void initializeUI() { |
| try { |
| TraceEvent.begin("ChromeTabbedActivity.initializeUI"); |
| @@ -1779,6 +1810,9 @@ public class ChromeTabbedActivity extends ChromeActivity implements OverviewMode |
| private void toggleOverview() { |
| Tab currentTab = getActivityTab(); |
| + if (currentTab == null) { |
| + mLayoutManager.showOverview(false); |
|
David Trainor- moved to gerrit
2017/05/23 06:16:43
Do we need this? If so, should we just return aft
ltian
2017/05/23 18:36:46
Originally, this is a separate check outside the t
|
| + } |
| ContentViewCore contentViewCore = |
| currentTab != null ? currentTab.getContentViewCore() : null; |