Chromium Code Reviews| 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 d5aa62871cf45c96649d40d3f45809298f3643e7..f378db427fa5ad2b80f189318eb927fd2685db38 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 |
| @@ -93,6 +93,8 @@ public class NewTabPage |
| private FakeboxDelegate mFakeboxDelegate; |
| private SnippetsBridge mSnippetsBridge; |
| + private boolean mVoiceInputEnabled = true; |
| + |
| // The timestamp at which the constructor was called. |
| private final long mConstructedTimeNs; |
| @@ -152,6 +154,11 @@ public class NewTabPage |
| * @return whether the provided native page is the one currently displayed to the user. |
| */ |
| boolean isCurrentPage(NativePage nativePage); |
| + |
| + /** |
| + * See LocationBarLayout#setUrlBarFocusable. |
| + */ |
| + void setUrlBarFocusable(boolean focusable); |
|
Ted C
2017/06/02 17:01:51
I feel there needs to be a path where this is isol
|
| } |
| /** |
| @@ -194,7 +201,8 @@ public class NewTabPage |
| @Override |
| public boolean isVoiceSearchEnabled() { |
| - return mFakeboxDelegate != null && mFakeboxDelegate.isVoiceSearchEnabled(); |
| + return mVoiceInputEnabled && mFakeboxDelegate != null |
| + && mFakeboxDelegate.isVoiceSearchEnabled(); |
| } |
| @TargetApi(Build.VERSION_CODES.LOLLIPOP) |
| @@ -405,6 +413,16 @@ public class NewTabPage |
| mNewTabPageView.setUrlFocusAnimationsDisabled(disable); |
| } |
| + /** |
| + * Updates whether input to the URL bar should be enabled. |
| + * @param enable Whether to enable URL Bar input. |
| + */ |
| + public void setUrlBarInputEnabled(boolean enable) { |
| + mFakeboxDelegate.setUrlBarFocusable(enable); |
| + mVoiceInputEnabled = enable; |
| + mNewTabPageView.updateVoiceSearchButtonVisibility(); |
| + } |
| + |
| private boolean isInSingleUrlBarMode(Context context) { |
| if (DeviceFormFactor.isTablet()) return false; |
| if (FeatureUtilities.isChromeHomeEnabled()) return false; |