Commit a308bcc8 authored by Bernhard Bauer's avatar Bernhard Bauer Committed by Commit Bot

Only show Google "G" in the New Tab Page omnibox if the search engine is Google.

Bug: 741882
Change-Id: Iac67445a218dd98a3d0a21fdf79588d0682c94e9
Reviewed-on: https://chromium-review.googlesource.com/570168
Commit-Queue: Bernhard Bauer <bauerb@chromium.org>
Reviewed-by: default avatarTheresa <twellington@chromium.org>
Cr-Commit-Position: refs/heads/master@{#486761}
parent 2a17bfdf
......@@ -23,6 +23,7 @@ import org.chromium.chrome.browser.ChromeFeatureList;
import org.chromium.chrome.browser.WindowDelegate;
import org.chromium.chrome.browser.locale.LocaleManager;
import org.chromium.chrome.browser.ntp.NewTabPage;
import org.chromium.chrome.browser.search_engines.TemplateUrlService;
import org.chromium.chrome.browser.toolbar.ToolbarDataProvider;
import org.chromium.chrome.browser.util.MathUtils;
import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet;
......@@ -230,10 +231,12 @@ public class LocationBarPhone extends LocationBarLayout {
return;
}
// If the default search engine is not Google, isLocationBarShownInNTP() will return false.
// Only access ChromeFeatureList and TemplateUrlService after the NTP check,
// to prevent native method calls before the native side has been initialized.
NewTabPage ntp = toolbarDataProvider.getNewTabPageForCurrentTab();
boolean isShownInRegularNtp = ntp != null && ntp.isLocationBarShownInNTP()
&& ChromeFeatureList.isEnabled(ChromeFeatureList.NTP_SHOW_GOOGLE_G_IN_OMNIBOX);
&& ChromeFeatureList.isEnabled(ChromeFeatureList.NTP_SHOW_GOOGLE_G_IN_OMNIBOX)
&& TemplateUrlService.getInstance().isDefaultSearchEngineGoogle();
boolean isShownInBottomSheetNtp =
mBottomSheet != null && mBottomSheet.shouldShowGoogleGInLocationBar();
......
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