| 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 f0c4e28f50f1ebc13f130246176aec3253084c3e..815276216ebe433877f0434b5b1faab0543eb56b 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
|
| @@ -27,6 +27,8 @@ import android.view.KeyEvent;
|
| import android.view.MotionEvent;
|
| import android.view.View;
|
| import android.view.accessibility.AccessibilityNodeInfo;
|
| +import android.view.inputmethod.EditorInfo;
|
| +import android.view.inputmethod.InputConnection;
|
| import android.widget.TextView;
|
|
|
| import org.chromium.base.ApiCompatibilityUtils;
|
| @@ -55,6 +57,11 @@ public class UrlBar extends AutocompleteEditText {
|
|
|
| private static final boolean DEBUG = false;
|
|
|
| + // TODO(tedchoc): Replace with EditorInfoCompat#IME_FLAG_NO_PERSONALIZED_LEARNING or
|
| + // EditorInfo#IME_FLAG_NO_PERSONALIZED_LEARNING as soon as either is available in
|
| + // all build config types.
|
| + private static final int IME_FLAG_NO_PERSONALIZED_LEARNING = 0x1000000;
|
| +
|
| // TextView becomes very slow on long strings, so we limit maximum length
|
| // of what is displayed to the user, see limitDisplayableLength().
|
| private static final int MAX_DISPLAYABLE_LENGTH = 4000;
|
| @@ -141,6 +148,11 @@ public class UrlBar extends AutocompleteEditText {
|
| Tab getCurrentTab();
|
|
|
| /**
|
| + * @return Whether the keyboard should be allowed to learn from the user input.
|
| + */
|
| + boolean allowKeyboardLearning();
|
| +
|
| + /**
|
| * Called when the text state has changed and the autocomplete suggestions should be
|
| * refreshed.
|
| *
|
| @@ -640,6 +652,15 @@ public class UrlBar extends AutocompleteEditText {
|
| }
|
|
|
| @Override
|
| + public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
|
| + InputConnection connection = super.onCreateInputConnection(outAttrs);
|
| + if (mUrlBarDelegate == null || !mUrlBarDelegate.allowKeyboardLearning()) {
|
| + outAttrs.imeOptions |= IME_FLAG_NO_PERSONALIZED_LEARNING;
|
| + }
|
| + return connection;
|
| + }
|
| +
|
| + @Override
|
| protected void onTextChanged(CharSequence text, int start, int lengthBefore, int lengthAfter) {
|
| super.onTextChanged(text, start, lengthBefore, lengthAfter);
|
| mIsPastedText = false;
|
|
|