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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPage.java

Issue 2133753002: 🏠Delay the URL focus effects if they happen before NTP is loaded. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use onLayoutChange Created 4 years, 5 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
Index: chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPage.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPage.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPage.java
index 742867deb4364f82dfc7e179a42ca879b2224378..3ae73cf8ae0eacf84e4b4f31bf5f3735697774c8 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPage.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPage.java
@@ -170,6 +170,11 @@
boolean isVoiceSearchEnabled();
/**
+ * @return Whether the URL bar is currently focused.
+ */
+ boolean isUrlBarFocused();
+
+ /**
* Focuses the URL bar when the user taps the fakebox, types in the fakebox, or pastes text
* into the fakebox.
*
@@ -715,6 +720,13 @@ public void setFakeboxDelegate(FakeboxDelegate fakeboxDelegate) {
mFakeboxDelegate = fakeboxDelegate;
if (mFakeboxDelegate != null) {
mNewTabPageView.updateVoiceSearchButtonVisibility();
+
+ // The toolbar can't get the reference to the native page until its initialization is
+ // finished, so we can't cache it here and transfer it to the view later. We pull that
+ // state from the location bar when we get a reference to it as a workaround.
+ if (fakeboxDelegate.isUrlBarFocused()) {
+ mNewTabPageView.setUrlFocusChangeAnimationPercent(1f);
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698