Chromium Code Reviews| Index: chrome/browser/autocomplete/autocomplete.cc |
| diff --git a/chrome/browser/autocomplete/autocomplete.cc b/chrome/browser/autocomplete/autocomplete.cc |
| index 8b4f9f74999ce7b44af73375f5ef91c20315a4e5..8cad8eff9a062823384f1456a6c138056f35c7f5 100644 |
| --- a/chrome/browser/autocomplete/autocomplete.cc |
| +++ b/chrome/browser/autocomplete/autocomplete.cc |
| @@ -719,6 +719,13 @@ void AutocompleteResult::SortAndCull(const AutocompleteInput& input) { |
| default_match_ = begin(); |
| + // TODO(msw): Somehow need to stop inlining stale data "a[mazon]" -> "ad". |
|
Peter Kasting
2012/05/04 00:11:33
We should never be reaching here with stale data.
msw
2012/05/04 09:43:40
It's no longer 'stale'; but see CopyOldMatches for
|
| + //if (default_match() != end() && |
| + // default_match()->inline_autocomplete_offset != string16::npos && |
| + // !StartsWith(default_match()->contents, input.text(), false)) { |
| + // matches_.begin()->inline_autocomplete_offset = string16::npos; |
| + //} |
| + |
| // Set the alternate nav URL. |
| alternate_nav_url_ = GURL(); |
| if (((input.type() == AutocompleteInput::UNKNOWN) || |
| @@ -998,6 +1005,8 @@ void AutocompleteController::UpdateResult(bool is_synchronous_pass) { |
| result_.AppendMatches((*i)->matches()); |
| // Sort the matches and trim to a small number of "best" matches. |
| + // TODO(msw): Remove or sanitize old matches? |
| + // (type == SEARCH_SUGGEST && from_previous == true)? |
| result_.SortAndCull(input_); |
| // Need to validate before invoking CopyOldMatches as the old matches are not |
| @@ -1015,25 +1024,22 @@ void AutocompleteController::UpdateResult(bool is_synchronous_pass) { |
| UpdateKeywordDescriptions(&result_); |
| UpdateAssociatedKeywords(&result_); |
| - bool notify_default_match = is_synchronous_pass; |
|
Peter Kasting
2012/05/04 00:11:33
Why wouldn't we want to always notify on the synch
msw
2012/05/04 09:43:40
Reverted.
|
| - if (!is_synchronous_pass) { |
| - const bool last_default_was_valid = |
| - last_result.default_match() != last_result.end(); |
| - const bool default_is_valid = result_.default_match() != result_.end(); |
| - // We've gotten async results. Send notification that the default match |
| - // updated if fill_into_edit differs or associated_keyword differ. (The |
| - // latter can change if we've just started Chrome and the keyword database |
| - // finishes loading while processing this request.) We don't check the URL |
| - // as that may change for the default match even though the fill into edit |
| - // hasn't changed (see SearchProvider for one case of this). |
| - notify_default_match = |
| - (last_default_was_valid != default_is_valid) || |
| - (default_is_valid && |
| - ((result_.default_match()->fill_into_edit != |
| - last_result.default_match()->fill_into_edit) || |
| - (result_.default_match()->associated_keyword.get() != |
| - last_result.default_match()->associated_keyword.get()))); |
| - } |
| + const bool last_default_was_valid = |
| + last_result.default_match() != last_result.end(); |
| + const bool default_is_valid = result_.default_match() != result_.end(); |
| + // We've gotten async results. Send notification that the default match |
| + // updated if fill_into_edit differs or associated_keyword differ. (The |
| + // latter can change if we've just started Chrome and the keyword database |
| + // finishes loading while processing this request.) We don't check the URL |
| + // as that may change for the default match even though the fill into edit |
| + // hasn't changed (see SearchProvider for one case of this). |
| + bool notify_default_match = |
| + (last_default_was_valid != default_is_valid) || |
| + (default_is_valid && |
| + ((result_.default_match()->fill_into_edit != |
| + last_result.default_match()->fill_into_edit) || |
| + (result_.default_match()->associated_keyword.get() != |
| + last_result.default_match()->associated_keyword.get()))); |
| NotifyChanged(notify_default_match); |
| } |