Commit 5217dd73 authored by Brandon Wylie's avatar Brandon Wylie Committed by Commit Bot

Prevent download/showing the google favicon instead of the google g

The issue here was that StatusMediator#updateLocationBarIcon is called
before the state for the dse icon is setup in
StatusMediator#updateSearchEngineStatusIcon. This results the google
icon being inadvertently downloaded and used instead of the large
google g. I added a flag to ensure that setup completes before
attempting to show a dse icon.

Bug: 1001659
Change-Id: I3b2c32c9710d81ccc6e4d498fb58a0e7ab0ae3cc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1808188
Commit-Queue: Brandon Wylie <wylieb@chromium.org>
Reviewed-by: default avatarTheresa  <twellington@chromium.org>
Cr-Commit-Position: refs/heads/master@{#697745}
parent eae7ecf7
...@@ -38,6 +38,7 @@ class StatusMediator { ...@@ -38,6 +38,7 @@ class StatusMediator {
private boolean mPageIsOffline; private boolean mPageIsOffline;
private boolean mShowStatusIconWhenUrlFocused; private boolean mShowStatusIconWhenUrlFocused;
private boolean mIsSecurityButtonShown; private boolean mIsSecurityButtonShown;
private boolean mIsSearchEngineStateSetup;
private boolean mIsSearchEngineGoogle; private boolean mIsSearchEngineGoogle;
private boolean mShouldCancelCustomFavicon; private boolean mShouldCancelCustomFavicon;
...@@ -298,8 +299,16 @@ class StatusMediator { ...@@ -298,8 +299,16 @@ class StatusMediator {
|| mPageIsOffline; || mPageIsOffline;
} }
/**
* Called when the search engine status icon needs updating.
*
* @param shouldShowSearchEngineLogo True if the search engine icon should be shown.
* @param isSearchEngineGoogle True if the default search engine is google.
* @param searchEngineUrl The URL for the search engine icon.
*/
public void updateSearchEngineStatusIcon(boolean shouldShowSearchEngineLogo, public void updateSearchEngineStatusIcon(boolean shouldShowSearchEngineLogo,
boolean isSearchEngineGoogle, String searchEngineUrl) { boolean isSearchEngineGoogle, String searchEngineUrl) {
mIsSearchEngineStateSetup = true;
mIsSearchEngineGoogle = isSearchEngineGoogle; mIsSearchEngineGoogle = isSearchEngineGoogle;
updateLocationBarIcon(); updateLocationBarIcon();
} }
...@@ -335,7 +344,7 @@ class StatusMediator { ...@@ -335,7 +344,7 @@ class StatusMediator {
&& mToolbarCommonPropertiesModel.getDisplaySearchTerms() != null && mToolbarCommonPropertiesModel.getDisplaySearchTerms() != null
&& SearchEngineLogoUtils.doesUrlMatchDefaultSearchEngine( && SearchEngineLogoUtils.doesUrlMatchDefaultSearchEngine(
mToolbarCommonPropertiesModel.getCurrentUrl()); mToolbarCommonPropertiesModel.getCurrentUrl());
if (SearchEngineLogoUtils.shouldShowSearchEngineLogo() if (SearchEngineLogoUtils.shouldShowSearchEngineLogo() && mIsSearchEngineStateSetup
&& (showFocused || showUnfocusedNewTabPage || showUnfocusedSearchResultsPage)) { && (showFocused || showUnfocusedNewTabPage || showUnfocusedSearchResultsPage)) {
mShouldCancelCustomFavicon = false; mShouldCancelCustomFavicon = false;
mModel.set(StatusProperties.STATUS_ICON_TINT_RES, 0); mModel.set(StatusProperties.STATUS_ICON_TINT_RES, 0);
......
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