Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4004)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java

Issue 2900463002: [Home] Add some NTP UI polish (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/phone/SimpleAnimationLayout.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java
index 07ac83201c5ef4fe7294920f92a5a915e660d278..12c8848c7ca170597f804ab9d52277fc560f734d 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java
@@ -1106,7 +1106,6 @@ public class LocationBarLayout extends FrameLayout
* - Native is loaded.
* - The URL bar has focus.
* - The current tab is not incognito.
- * - Chrome Home is disabled.
*/
private void startZeroSuggest() {
// Reset "edited" state in the omnibox if zero suggest is triggered -- new edits
@@ -1151,11 +1150,21 @@ public class LocationBarLayout extends FrameLayout
boolean preventAutocomplete = textDeleted || !mUrlBar.shouldAutocomplete();
mRequestSuggestions = null;
- if (getCurrentTab() == null) return;
- mAutocomplete.start(
- getCurrentTab().getProfile(),
- getCurrentTab().getUrl(),
- textWithoutAutocomplete, preventAutocomplete);
+
+ if (getCurrentTab() == null
+ && (mBottomSheet == null || mToolbarDataProvider.isIncognito())) {
+ return;
+ }
+
+ // If the bottom sheet is not null, the current tab will be null when the
+ // NTP UI is showing. Use the original profile rather than the tab profile
+ // in that scenario.
+ Profile profile = getCurrentTab() != null
+ ? getCurrentTab().getProfile()
+ : Profile.getLastUsedProfile().getOriginalProfile();
+ String url = getCurrentTab() != null ? getCurrentTab().getUrl()
+ : UrlConstants.NTP_URL;
+ mAutocomplete.start(profile, url, textWithoutAutocomplete, preventAutocomplete);
}
};
if (mNativeInitialized) {
@@ -1874,6 +1883,9 @@ public class LocationBarLayout extends FrameLayout
if (getCurrentTab() != null) {
mAutocomplete.start(
getCurrentTab().getProfile(), getCurrentTab().getUrl(), query, false);
+ } else if (mBottomSheet != null && !mToolbarDataProvider.isIncognito()) {
+ mAutocomplete.start(Profile.getLastUsedProfile().getOriginalProfile(),
+ UrlConstants.NTP_URL, query, false);
}
post(new Runnable() {
@Override
@@ -2011,7 +2023,8 @@ public class LocationBarLayout extends FrameLayout
if (mNativeInitialized
&& !CommandLine.getInstance().hasSwitch(ChromeSwitches.DISABLE_INSTANT)
- && PrivacyPreferencesManager.getInstance().shouldPrerender()) {
+ && PrivacyPreferencesManager.getInstance().shouldPrerender()
+ && getCurrentTab() != null) {
mOmniboxPrerender.prerenderMaybe(
userText,
getOriginalUrl(),
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/phone/SimpleAnimationLayout.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698