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

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

Issue 10867061: Pass user_text and full_text explicitly to Instant. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove out params from Update() Created 8 years, 4 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') | no next file » | 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 3b1cd78c544051287ce9a022468e35901a3abe5e..5fc39208de5e8044eeec8f5c67a6692a6e222b08 100644
--- a/chrome/browser/ui/omnibox/omnibox_edit_model.cc
+++ b/chrome/browser/ui/omnibox/omnibox_edit_model.cc
@@ -243,12 +243,7 @@ void OmniboxEditModel::OnChanged() {
recommended_action,
AutocompleteActionPredictor::LAST_PREDICT_ACTION);
- string16 suggested_text;
- InstantCompleteBehavior complete_behavior = INSTANT_COMPLETE_NOW;
-
- if (DoInstant(current_match, &suggested_text, &complete_behavior)) {
- SetSuggestedText(suggested_text, complete_behavior);
- } else {
+ if (!DoInstant(current_match)) {
switch (recommended_action) {
case AutocompleteActionPredictor::ACTION_PRERENDER:
DoPrerender(current_match);
@@ -1109,13 +1104,7 @@ void OmniboxEditModel::NotifySearchTabHelper() {
}
}
-bool OmniboxEditModel::DoInstant(
- const AutocompleteMatch& match,
- string16* suggested_text,
- InstantCompleteBehavior* complete_behavior) {
- DCHECK(suggested_text);
- DCHECK(complete_behavior);
-
+bool OmniboxEditModel::DoInstant(const AutocompleteMatch& match) {
if (in_revert_)
return false;
@@ -1126,24 +1115,26 @@ bool OmniboxEditModel::DoInstant(
if (user_input_in_progress_ && popup_->IsOpen()) {
// The two pieces of text we want to send Instant, viz., what the user has
- // typed, and any inline autocomplete suggestion.
+ // typed, and the full omnibox text including any inline autocompletion.
string16 user_text = user_text_;
- *suggested_text = inline_autocomplete_text_;
+ string16 full_text = user_text_ + inline_autocomplete_text_;
// If there's temporary text, that overrides the user_text. In this case, we
// should ignore any inline_autocomplete_text_, because it won't be visible.
- if (has_temporary_text_) {
- user_text = CurrentMatch().fill_into_edit;
- suggested_text->clear();
- }
+ if (has_temporary_text_)
+ user_text = full_text = CurrentMatch().fill_into_edit;
- // Remove any keywords and "?" prefix.
+ // Remove keyword if we're in keyword mode.
user_text = DisplayTextFromUserText(user_text);
+ full_text = DisplayTextFromUserText(full_text);
+
+ // Remove "?" if we're in forced query mode.
AutocompleteInput::RemoveForcedQueryStringIfNecessary(
autocomplete_controller_->input().type(), &user_text);
+ AutocompleteInput::RemoveForcedQueryStringIfNecessary(
+ autocomplete_controller_->input().type(), &full_text);
- return instant->Update(match, user_text, UseVerbatimInstant(),
- suggested_text, complete_behavior);
+ return instant->Update(match, user_text, full_text, UseVerbatimInstant());
}
// It's possible DoInstant() was called due to an OnChanged() event from the
« no previous file with comments | « chrome/browser/ui/omnibox/omnibox_edit_model.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698