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

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

Issue 1845033002: Ensure omnibox suggestions are regenerated when deleting the inline autocomplete. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address newt@ comments Created 4 years, 9 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/javatests/src/org/chromium/chrome/browser/omnibox/UrlBarTest.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 920d241b5712d89a7b507696985821816ff194b8..41644707c9310751c7543fc8f2748b52924b8eab 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
@@ -117,7 +117,8 @@ public class UrlBar extends VerticallyFixedEditText {
private long mFirstFocusTimeMs;
private boolean mInBatchEditMode;
- private String mBeforeBatchEditAutocompleteText;
+ private int mBeforeBatchEditAutocompleteIndex = -1;
+ private String mBeforeBatchEditFullText;
private boolean mSelectionChangedInBatchMode;
private boolean mTextDeletedInBatchMode;
@@ -360,7 +361,8 @@ public class UrlBar extends VerticallyFixedEditText {
@Override
public void onBeginBatchEdit() {
- mBeforeBatchEditAutocompleteText = getTextWithoutAutocomplete();
+ mBeforeBatchEditAutocompleteIndex = getText().getSpanStart(mAutocompleteSpan);
+ mBeforeBatchEditFullText = getText().toString();
super.onBeginBatchEdit();
mInBatchEditMode = true;
@@ -377,12 +379,14 @@ public class UrlBar extends VerticallyFixedEditText {
mSelectionChangedInBatchMode = false;
}
- if (!TextUtils.equals(mBeforeBatchEditAutocompleteText, getTextWithoutAutocomplete())) {
+ if (!TextUtils.equals(mBeforeBatchEditFullText, getText().toString())
+ || getText().getSpanStart(mAutocompleteSpan) != mBeforeBatchEditAutocompleteIndex) {
notifyAutocompleteTextStateChanged(mTextDeletedInBatchMode);
}
mTextDeletedInBatchMode = false;
- mBeforeBatchEditAutocompleteText = null;
+ mBeforeBatchEditAutocompleteIndex = -1;
+ mBeforeBatchEditFullText = null;
}
@Override
« no previous file with comments | « no previous file | chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/UrlBarTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698