Commit 743250dc authored by gogerald's avatar gogerald Committed by Commit Bot

[StartSurface] Fix setTabSwitcherToolbarVisibility crash

Bug: 1021399
Change-Id: I7b9aa63e6613b495614b38acbf850786c159054b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1899408
Commit-Queue: Ganggui Tang <gogerald@chromium.org>
Reviewed-by: default avatarYusuf Ozuysal <yusufo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#712678}
parent 28703c1a
...@@ -415,7 +415,10 @@ class StartSurfaceMediator ...@@ -415,7 +415,10 @@ class StartSurfaceMediator
mSecondaryTasksSurfacePropertyModel.set(IS_INCOGNITO, mIsIncognito); mSecondaryTasksSurfacePropertyModel.set(IS_INCOGNITO, mIsIncognito);
} }
notifyStateChange(); // TODO(crbug.com/1021399): This looks not needed since there is no way to change incognito
// mode when focusing on the omnibox and incognito mode change won't affect the visibility
// of the tab switcher toolbar.
if (mPropertyModel.get(IS_SHOWING_OVERVIEW)) notifyStateChange();
} }
private void setSecondaryTasksSurfaceVisibility(boolean isVisible) { private void setSecondaryTasksSurfaceVisibility(boolean isVisible) {
...@@ -436,6 +439,7 @@ class StartSurfaceMediator ...@@ -436,6 +439,7 @@ class StartSurfaceMediator
private void notifyStateChange() { private void notifyStateChange() {
assert mSurfaceMode != SurfaceMode.NO_START_SURFACE; assert mSurfaceMode != SurfaceMode.NO_START_SURFACE;
assert mPropertyModel.get(IS_SHOWING_OVERVIEW);
if (mStateObserver != null) { if (mStateObserver != null) {
mStateObserver.onStateChanged(shouldShowTabSwitcherToolbar()); mStateObserver.onStateChanged(shouldShowTabSwitcherToolbar());
......
...@@ -163,7 +163,8 @@ class TabSwitcherModeTTCoordinatorPhone implements TemplateUrlServiceObserver { ...@@ -163,7 +163,8 @@ class TabSwitcherModeTTCoordinatorPhone implements TemplateUrlServiceObserver {
} }
void setTabSwitcherToolbarVisibility(boolean shouldShowTabSwitcherToolbar) { void setTabSwitcherToolbarVisibility(boolean shouldShowTabSwitcherToolbar) {
if ((mTabSwitcherModeToolbar.getVisibility() == View.VISIBLE) if (mTabSwitcherModeToolbar == null
|| (mTabSwitcherModeToolbar.getVisibility() == View.VISIBLE)
== shouldShowTabSwitcherToolbar) { == shouldShowTabSwitcherToolbar) {
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment