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

Unified Diff: chrome/browser/ui/omnibox/omnibox_edit_model.cc

Issue 19197005: Omnibox: Change |inline_autocomplete_offset| to |inline_autocompletion| (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: drop user_text() in omnibox_edit_model Created 7 years, 5 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 | « chrome/browser/ui/omnibox/omnibox_edit_model.h ('k') | chrome/browser/ui/omnibox/omnibox_popup_model.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/omnibox/omnibox_edit_model.cc
diff --git a/chrome/browser/ui/omnibox/omnibox_edit_model.cc b/chrome/browser/ui/omnibox/omnibox_edit_model.cc
index 6ba8740707a2043a1534829e5670972b48e02585..8ea2778f5c69667cc11f50eaaa8b0874daab81ee 100644
--- a/chrome/browser/ui/omnibox/omnibox_edit_model.cc
+++ b/chrome/browser/ui/omnibox/omnibox_edit_model.cc
@@ -628,7 +628,7 @@ void OmniboxEditModel::OpenMatch(const AutocompleteMatch& match,
delegate_->CurrentPageExists() ? ClassifyPage(delegate_->GetURL()) :
metrics::OmniboxEventProto_PageClassification_OTHER,
elapsed_time_since_user_first_modified_omnibox,
- string16::npos, // completed_length; possibly set later
+ match.inline_autocompletion.length(),
elapsed_time_since_last_change_to_default_match,
result());
@@ -646,12 +646,6 @@ void OmniboxEditModel::OpenMatch(const AutocompleteMatch& match,
if (index != OmniboxPopupModel::kNoMatch)
log.selected_index = index;
- if (match.inline_autocomplete_offset != string16::npos) {
- DCHECK_GE(match.fill_into_edit.length(),
- match.inline_autocomplete_offset);
- log.completed_length =
- match.fill_into_edit.length() - match.inline_autocomplete_offset;
- }
if ((disposition == CURRENT_TAB) && delegate_->CurrentPageExists()) {
// If we know the destination is being opened in the current tab,
@@ -1100,6 +1094,8 @@ bool OmniboxEditModel::OnAfterPossibleChange(const string16& old_text,
MaybeAcceptKeywordBySpace(user_text_));
}
+// TODO(beaudoin): Merge OnPopupDataChanged with this method once the popup
+// handling has completely migrated to omnibox_controller.
void OmniboxEditModel::OnCurrentMatchChanged() {
has_temporary_text_ = false;
@@ -1110,17 +1106,12 @@ void OmniboxEditModel::OnCurrentMatchChanged() {
string16 keyword;
bool is_keyword_hint;
match.GetKeywordUIState(profile_, &keyword, &is_keyword_hint);
- string16 inline_autocomplete_text;
- if (match.inline_autocomplete_offset < match.fill_into_edit.length()) {
- // We have blue text, go through OnPopupDataChanged.
- // TODO(beaudoin): Merge OnPopupDataChanged with this method once the
- // popup handling has completely migrated to omnibox_controller.
- inline_autocomplete_text =
- match.fill_into_edit.substr(match.inline_autocomplete_offset);
- }
popup_model()->OnResultChanged();
- OnPopupDataChanged(inline_autocomplete_text, NULL, keyword,
- is_keyword_hint);
+ // OnPopupDataChanged() resets OmniboxController's |current_match_| early
+ // on. Therefore, copy match.inline_autocompletion to a temp to preserve
+ // its value across the entire call.
+ const string16 inline_autocompletion(match.inline_autocompletion);
+ OnPopupDataChanged(inline_autocompletion, NULL, keyword, is_keyword_hint);
}
string16 OmniboxEditModel::GetViewText() const {
« no previous file with comments | « chrome/browser/ui/omnibox/omnibox_edit_model.h ('k') | chrome/browser/ui/omnibox/omnibox_popup_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698