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

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

Issue 1207523003: Make urlbar in custom tabs not focusable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: one nit Created 5 years, 6 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 | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/toolbar/CustomTabToolbar.java » ('j') | 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/UrlBar.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/UrlBar.java b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/UrlBar.java
index 7d344a5b06c82440a48c337e5291cf2d8e821915..d3656bc4438d172576ee81effc21dd3980fe09be 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/UrlBar.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/UrlBar.java
@@ -84,6 +84,7 @@ public class UrlBar extends VerticallyFixedEditText {
*/
private final GestureDetector mGestureDetector;
private boolean mFocused;
+ private boolean mAllowFocus = true;
private final ColorStateList mDarkHintColor;
private final int mDarkDefaultTextColor;
@@ -369,6 +370,17 @@ public class UrlBar extends VerticallyFixedEditText {
return mFirstFocusTimeMs;
}
+ /**
+ * Sets whether this {@link UrlBar} should be focusable.
+ */
+ public void setAllowFocus(boolean allowFocus) {
+ mAllowFocus = allowFocus;
+ if (mFirstDrawComplete) {
+ setFocusable(allowFocus);
+ setFocusableInTouchMode(allowFocus);
+ }
+ }
+
@Override
protected void onWindowVisibilityChanged(int visibility) {
super.onWindowVisibilityChanged(visibility);
@@ -478,11 +490,13 @@ public class UrlBar extends VerticallyFixedEditText {
// We have now avoided the first draw problem (see the comment in
// the constructor) so we want to make the URL bar focusable so that
// touches etc. activate it.
- setFocusable(true);
- setFocusableInTouchMode(true);
+ setFocusable(mAllowFocus);
+ setFocusableInTouchMode(mAllowFocus);
// The URL bar will now react correctly to a focus change event
- if (mOmniboxLivenessListener != null) mOmniboxLivenessListener.onOmniboxInteractive();
+ if (mOmniboxLivenessListener != null) {
+ mOmniboxLivenessListener.onOmniboxInteractive();
+ }
}
// Notify listeners if the URL's direction has changed.
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/toolbar/CustomTabToolbar.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698