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

Side by Side Diff: chrome/browser/ui/omnibox/omnibox_edit_model.cc

Issue 10918289: Instant extended API: Make arrow up/down work. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Hackiness noted Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" 5 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 : ALLOW_THIS_IN_INITIALIZER_LIST( 87 : ALLOW_THIS_IN_INITIALIZER_LIST(
88 autocomplete_controller_(new AutocompleteController(profile, this, 88 autocomplete_controller_(new AutocompleteController(profile, this,
89 AutocompleteClassifier::kDefaultOmniboxProviders))), 89 AutocompleteClassifier::kDefaultOmniboxProviders))),
90 view_(view), 90 view_(view),
91 popup_(NULL), 91 popup_(NULL),
92 controller_(controller), 92 controller_(controller),
93 has_focus_(false), 93 has_focus_(false),
94 user_input_in_progress_(false), 94 user_input_in_progress_(false),
95 just_deleted_text_(false), 95 just_deleted_text_(false),
96 has_temporary_text_(false), 96 has_temporary_text_(false),
97 is_temporary_text_set_by_instant_(false),
97 paste_state_(NONE), 98 paste_state_(NONE),
98 control_key_state_(UP), 99 control_key_state_(UP),
99 is_keyword_hint_(false), 100 is_keyword_hint_(false),
100 profile_(profile), 101 profile_(profile),
101 in_revert_(false), 102 in_revert_(false),
102 allow_exact_keyword_match_(false) { 103 allow_exact_keyword_match_(false) {
103 } 104 }
104 105
105 OmniboxEditModel::~OmniboxEditModel() { 106 OmniboxEditModel::~OmniboxEditModel() {
106 } 107 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 159
159 GURL OmniboxEditModel::PermanentURL() { 160 GURL OmniboxEditModel::PermanentURL() {
160 return URLFixerUpper::FixupURL(UTF16ToUTF8(permanent_text_), std::string()); 161 return URLFixerUpper::FixupURL(UTF16ToUTF8(permanent_text_), std::string());
161 } 162 }
162 163
163 void OmniboxEditModel::SetUserText(const string16& text) { 164 void OmniboxEditModel::SetUserText(const string16& text) {
164 SetInputInProgress(true); 165 SetInputInProgress(true);
165 InternalSetUserText(text); 166 InternalSetUserText(text);
166 paste_state_ = NONE; 167 paste_state_ = NONE;
167 has_temporary_text_ = false; 168 has_temporary_text_ = false;
169 is_temporary_text_set_by_instant_ = false;
168 } 170 }
169 171
170 void OmniboxEditModel::FinalizeInstantQuery(const string16& input_text, 172 void OmniboxEditModel::FinalizeInstantQuery(const string16& input_text,
171 const string16& suggest_text, 173 const string16& suggest_text,
172 bool skip_inline_autocomplete) { 174 bool skip_inline_autocomplete) {
173 if (skip_inline_autocomplete) { 175 if (skip_inline_autocomplete) {
174 const string16 final_text = input_text + suggest_text; 176 const string16 final_text = input_text + suggest_text;
175 view_->OnBeforePossibleChange(); 177 view_->OnBeforePossibleChange();
176 view_->SetWindowTextAndCaretPos(final_text, final_text.length(), false, 178 view_->SetWindowTextAndCaretPos(final_text, final_text.length(), false,
177 false); 179 false);
178 view_->OnAfterPossibleChange(); 180 view_->OnAfterPossibleChange();
179 } else if (popup_->IsOpen()) { 181 } else if (popup_->IsOpen()) {
180 SearchProvider* search_provider = 182 SearchProvider* search_provider =
181 autocomplete_controller_->search_provider(); 183 autocomplete_controller_->search_provider();
182 // There may be no providers during testing; guard against that. 184 // There may be no providers during testing; guard against that.
183 if (search_provider) 185 if (search_provider)
184 search_provider->FinalizeInstantQuery(input_text, suggest_text); 186 search_provider->FinalizeInstantQuery(input_text, suggest_text);
185 } 187 }
186 } 188 }
187 189
188 void OmniboxEditModel::SetSuggestedText(const string16& text, 190 void OmniboxEditModel::SetSuggestedText(const string16& text,
189 InstantCompleteBehavior behavior) { 191 InstantCompleteBehavior behavior) {
190 if (behavior == INSTANT_COMPLETE_NOW) { 192 switch (behavior) {
191 if (!text.empty()) 193 case INSTANT_COMPLETE_NOW:
192 FinalizeInstantQuery(view_->GetText(), text, false); 194 view_->SetInstantSuggestion(string16(), false);
193 else 195 if (!text.empty())
196 FinalizeInstantQuery(view_->GetText(), text, false);
197 break;
198
199 case INSTANT_COMPLETE_DELAYED:
200 // Starts out as gray text (i.e., INSTANT_COMPLETE_NEVER) and animates to
201 // completed blue text by way of CommitSuggestedText().
202 view_->SetInstantSuggestion(text, true);
203 break;
204
205 case INSTANT_COMPLETE_NEVER:
194 view_->SetInstantSuggestion(text, false); 206 view_->SetInstantSuggestion(text, false);
195 } else { 207 break;
196 DCHECK((behavior == INSTANT_COMPLETE_DELAYED) || 208
197 (behavior == INSTANT_COMPLETE_NEVER)); 209 case INSTANT_COMPLETE_REPLACE:
198 view_->SetInstantSuggestion(text, behavior == INSTANT_COMPLETE_DELAYED); 210 view_->SetInstantSuggestion(string16(), false);
211 has_temporary_text_ = true;
212 is_temporary_text_set_by_instant_ = true;
213 view_->SetWindowTextAndCaretPos(text, text.size(), false, false);
214 break;
199 } 215 }
200 } 216 }
201 217
202 bool OmniboxEditModel::CommitSuggestedText(bool skip_inline_autocomplete) { 218 bool OmniboxEditModel::CommitSuggestedText(bool skip_inline_autocomplete) {
203 if (!controller_->GetInstant()) 219 if (!controller_->GetInstant())
204 return false; 220 return false;
205 221
206 const string16 suggestion = view_->GetInstantSuggestion(); 222 const string16 suggestion = view_->GetInstantSuggestion();
207 if (suggestion.empty()) 223 if (suggestion.empty())
208 return false; 224 return false;
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 NotifySearchTabHelper(); 418 NotifySearchTabHelper();
403 } 419 }
404 420
405 void OmniboxEditModel::Revert() { 421 void OmniboxEditModel::Revert() {
406 SetInputInProgress(false); 422 SetInputInProgress(false);
407 paste_state_ = NONE; 423 paste_state_ = NONE;
408 InternalSetUserText(string16()); 424 InternalSetUserText(string16());
409 keyword_.clear(); 425 keyword_.clear();
410 is_keyword_hint_ = false; 426 is_keyword_hint_ = false;
411 has_temporary_text_ = false; 427 has_temporary_text_ = false;
428 is_temporary_text_set_by_instant_ = false;
412 view_->SetWindowTextAndCaretPos(permanent_text_, 429 view_->SetWindowTextAndCaretPos(permanent_text_,
413 has_focus_ ? permanent_text_.length() : 0, 430 has_focus_ ? permanent_text_.length() : 0,
414 false, true); 431 false, true);
415 AutocompleteActionPredictor* action_predictor = 432 AutocompleteActionPredictor* action_predictor =
416 AutocompleteActionPredictorFactory::GetForProfile(profile_); 433 AutocompleteActionPredictorFactory::GetForProfile(profile_);
417 if (action_predictor) 434 if (action_predictor)
418 action_predictor->ClearTransitionalMatches(); 435 action_predictor->ClearTransitionalMatches();
419 } 436 }
420 437
421 void OmniboxEditModel::StartAutocomplete( 438 void OmniboxEditModel::StartAutocomplete(
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 OmniboxPopupModel::kNoMatch); 527 OmniboxPopupModel::kNoMatch);
511 } 528 }
512 529
513 void OmniboxEditModel::OpenMatch(const AutocompleteMatch& match, 530 void OmniboxEditModel::OpenMatch(const AutocompleteMatch& match,
514 WindowOpenDisposition disposition, 531 WindowOpenDisposition disposition,
515 const GURL& alternate_nav_url, 532 const GURL& alternate_nav_url,
516 size_t index) { 533 size_t index) {
517 // We only care about cases where there is a selection (i.e. the popup is 534 // We only care about cases where there is a selection (i.e. the popup is
518 // open). 535 // open).
519 if (popup_->IsOpen()) { 536 if (popup_->IsOpen()) {
537 // TODO(sreeram): Handle is_temporary_text_set_by_instant_ correctly.
520 AutocompleteLog log( 538 AutocompleteLog log(
521 autocomplete_controller_->input().text(), 539 autocomplete_controller_->input().text(),
522 just_deleted_text_, 540 just_deleted_text_,
523 autocomplete_controller_->input().type(), 541 autocomplete_controller_->input().type(),
524 popup_->selected_line(), 542 popup_->selected_line(),
525 -1, // don't yet know tab ID; set later if appropriate 543 -1, // don't yet know tab ID; set later if appropriate
526 ClassifyPage(controller_->GetTabContents()-> 544 ClassifyPage(controller_->GetTabContents()->
527 web_contents()->GetURL()), 545 web_contents()->GetURL()),
528 base::TimeTicks::Now() - time_user_first_modified_omnibox_, 546 base::TimeTicks::Now() - time_user_first_modified_omnibox_,
529 0, // inline autocomplete length; possibly set later 547 0, // inline autocomplete length; possibly set later
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 if (popup_->IsOpen()) 661 if (popup_->IsOpen())
644 popup_->SetSelectedLineState(OmniboxPopupModel::KEYWORD); 662 popup_->SetSelectedLineState(OmniboxPopupModel::KEYWORD);
645 else 663 else
646 StartAutocomplete(false, true); 664 StartAutocomplete(false, true);
647 665
648 // Ensure the current selection is saved before showing keyword mode 666 // Ensure the current selection is saved before showing keyword mode
649 // so that moving to another line and then reverting the text will restore 667 // so that moving to another line and then reverting the text will restore
650 // the current state properly. 668 // the current state properly.
651 bool save_original_selection = !has_temporary_text_; 669 bool save_original_selection = !has_temporary_text_;
652 has_temporary_text_ = true; 670 has_temporary_text_ = true;
671 is_temporary_text_set_by_instant_ = false;
653 view_->OnTemporaryTextMaybeChanged( 672 view_->OnTemporaryTextMaybeChanged(
654 DisplayTextFromUserText(CurrentMatch().fill_into_edit), 673 DisplayTextFromUserText(CurrentMatch().fill_into_edit),
655 save_original_selection); 674 save_original_selection);
656 675
657 content::RecordAction(UserMetricsAction("AcceptedKeywordHint")); 676 content::RecordAction(UserMetricsAction("AcceptedKeywordHint"));
658 return true; 677 return true;
659 } 678 }
660 679
661 void OmniboxEditModel::ClearKeyword(const string16& visible_text) { 680 void OmniboxEditModel::ClearKeyword(const string16& visible_text) {
662 autocomplete_controller_->Stop(false); 681 autocomplete_controller_->Stop(false);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 void OmniboxEditModel::OnControlKeyChanged(bool pressed) { 780 void OmniboxEditModel::OnControlKeyChanged(bool pressed) {
762 // Don't change anything unless the key state is actually toggling. 781 // Don't change anything unless the key state is actually toggling.
763 if (pressed == (control_key_state_ == UP)) { 782 if (pressed == (control_key_state_ == UP)) {
764 ControlKeyState old_state = control_key_state_; 783 ControlKeyState old_state = control_key_state_;
765 control_key_state_ = pressed ? DOWN_WITHOUT_CHANGE : UP; 784 control_key_state_ = pressed ? DOWN_WITHOUT_CHANGE : UP;
766 if ((control_key_state_ == DOWN_WITHOUT_CHANGE) && has_temporary_text_) { 785 if ((control_key_state_ == DOWN_WITHOUT_CHANGE) && has_temporary_text_) {
767 // Arrowing down and then hitting control accepts the temporary text as 786 // Arrowing down and then hitting control accepts the temporary text as
768 // the input text. 787 // the input text.
769 InternalSetUserText(UserTextFromDisplayText(view_->GetText())); 788 InternalSetUserText(UserTextFromDisplayText(view_->GetText()));
770 has_temporary_text_ = false; 789 has_temporary_text_ = false;
790 is_temporary_text_set_by_instant_ = false;
771 if (KeywordIsSelected()) 791 if (KeywordIsSelected())
772 AcceptKeyword(); 792 AcceptKeyword();
773 } 793 }
774 if ((old_state != DOWN_WITH_CHANGE) && popup_->IsOpen()) { 794 if ((old_state != DOWN_WITH_CHANGE) && popup_->IsOpen()) {
775 // Autocomplete history provider results may change, so refresh the 795 // Autocomplete history provider results may change, so refresh the
776 // popup. This will force user_input_in_progress_ to true, but if the 796 // popup. This will force user_input_in_progress_ to true, but if the
777 // popup is open, that should have already been the case. 797 // popup is open, that should have already been the case.
778 view_->UpdatePopup(); 798 view_->UpdatePopup();
779 } 799 }
780 } 800 }
781 } 801 }
782 802
783 void OmniboxEditModel::OnUpOrDownKeyPressed(int count) { 803 void OmniboxEditModel::OnUpOrDownKeyPressed(int count) {
784 // NOTE: This purposefully don't trigger any code that resets paste_state_. 804 // If Instant handles the key press, it's showing a list of suggestions that
805 // it's stepping through. In that case, our popup model is irrelevant, so
806 // don't process the key press ourselves. However, do stop the autocomplete
807 // system from changing the results.
808 InstantController* instant = controller_->GetInstant();
809 if (instant && instant->OnUpOrDownKeyPressed(count)) {
810 autocomplete_controller_->Stop(false);
811 return;
812 }
785 813
814 // NOTE: This purposefully doesn't trigger any code that resets paste_state_.
786 if (!popup_->IsOpen()) { 815 if (!popup_->IsOpen()) {
787 if (!query_in_progress()) { 816 if (!query_in_progress()) {
788 // The popup is neither open nor working on a query already. So, start an 817 // The popup is neither open nor working on a query already. So, start an
789 // autocomplete query for the current text. This also sets 818 // autocomplete query for the current text. This also sets
790 // user_input_in_progress_ to true, which we want: if the user has started 819 // user_input_in_progress_ to true, which we want: if the user has started
791 // to interact with the popup, changing the permanent_text_ shouldn't 820 // to interact with the popup, changing the permanent_text_ shouldn't
792 // change the displayed text. 821 // change the displayed text.
793 // Note: This does not force the popup to open immediately. 822 // Note: This does not force the popup to open immediately.
794 // TODO(pkasting): We should, in fact, force this particular query to open 823 // TODO(pkasting): We should, in fact, force this particular query to open
795 // the popup immediately. 824 // the popup immediately.
(...skipping 26 matching lines...) Expand all
822 // |is_keyword_hint_| should always be false if |keyword_| is empty. 851 // |is_keyword_hint_| should always be false if |keyword_| is empty.
823 DCHECK(!keyword_.empty() || !is_keyword_hint_); 852 DCHECK(!keyword_.empty() || !is_keyword_hint_);
824 } 853 }
825 854
826 // Handle changes to temporary text. 855 // Handle changes to temporary text.
827 if (destination_for_temporary_text_change != NULL) { 856 if (destination_for_temporary_text_change != NULL) {
828 const bool save_original_selection = !has_temporary_text_; 857 const bool save_original_selection = !has_temporary_text_;
829 if (save_original_selection) { 858 if (save_original_selection) {
830 // Save the original selection and URL so it can be reverted later. 859 // Save the original selection and URL so it can be reverted later.
831 has_temporary_text_ = true; 860 has_temporary_text_ = true;
861 is_temporary_text_set_by_instant_ = false;
832 original_url_ = *destination_for_temporary_text_change; 862 original_url_ = *destination_for_temporary_text_change;
833 inline_autocomplete_text_.clear(); 863 inline_autocomplete_text_.clear();
834 } 864 }
835 if (control_key_state_ == DOWN_WITHOUT_CHANGE) { 865 if (control_key_state_ == DOWN_WITHOUT_CHANGE) {
836 // Arrowing around the popup cancels control-enter. 866 // Arrowing around the popup cancels control-enter.
837 control_key_state_ = DOWN_WITH_CHANGE; 867 control_key_state_ = DOWN_WITH_CHANGE;
838 // Now things are a bit screwy: the desired_tld has changed, but if we 868 // Now things are a bit screwy: the desired_tld has changed, but if we
839 // update the popup, the new order of entries won't match the old, so the 869 // update the popup, the new order of entries won't match the old, so the
840 // user's selection gets screwy; and if we don't update the popup, and the 870 // user's selection gets screwy; and if we don't update the popup, and the
841 // user reverts, then the selected item will be as if control is still 871 // user reverts, then the selected item will be as if control is still
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 } else if (!user_text_changed) { 931 } else if (!user_text_changed) {
902 return false; 932 return false;
903 } 933 }
904 934
905 // If the user text has not changed, we do not want to change the model's 935 // If the user text has not changed, we do not want to change the model's
906 // state associated with the text. Otherwise, we can get surprising behavior 936 // state associated with the text. Otherwise, we can get surprising behavior
907 // where the autocompleted text unexpectedly reappears, e.g. crbug.com/55983 937 // where the autocompleted text unexpectedly reappears, e.g. crbug.com/55983
908 if (user_text_changed) { 938 if (user_text_changed) {
909 InternalSetUserText(UserTextFromDisplayText(new_text)); 939 InternalSetUserText(UserTextFromDisplayText(new_text));
910 has_temporary_text_ = false; 940 has_temporary_text_ = false;
941 is_temporary_text_set_by_instant_ = false;
911 942
912 // Track when the user has deleted text so we won't allow inline 943 // Track when the user has deleted text so we won't allow inline
913 // autocomplete. 944 // autocomplete.
914 just_deleted_text_ = just_deleted_text; 945 just_deleted_text_ = just_deleted_text;
915 } 946 }
916 947
917 const bool no_selection = selection_start == selection_end; 948 const bool no_selection = selection_start == selection_end;
918 949
919 // Update the popup for the change, in the process changing to keyword mode 950 // Update the popup for the change, in the process changing to keyword mode
920 // if the user hit space in mid-string after a keyword. 951 // if the user hit space in mid-string after a keyword.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 popup_->OnResultChanged(); 1014 popup_->OnResultChanged();
984 } 1015 }
985 1016
986 if (popup_->IsOpen()) { 1017 if (popup_->IsOpen()) {
987 PopupBoundsChangedTo(popup_->view()->GetTargetBounds()); 1018 PopupBoundsChangedTo(popup_->view()->GetTargetBounds());
988 } else if (was_open) { 1019 } else if (was_open) {
989 // Accepts the temporary text as the user text, because it makes little 1020 // Accepts the temporary text as the user text, because it makes little
990 // sense to have temporary text when the popup is closed. 1021 // sense to have temporary text when the popup is closed.
991 InternalSetUserText(UserTextFromDisplayText(view_->GetText())); 1022 InternalSetUserText(UserTextFromDisplayText(view_->GetText()));
992 has_temporary_text_ = false; 1023 has_temporary_text_ = false;
1024 is_temporary_text_set_by_instant_ = false;
993 PopupBoundsChangedTo(gfx::Rect()); 1025 PopupBoundsChangedTo(gfx::Rect());
994 NotifySearchTabHelper(); 1026 NotifySearchTabHelper();
995 } 1027 }
996 1028
997 if (InstantController* instant = controller_->GetInstant()) 1029 if (InstantController* instant = controller_->GetInstant())
998 instant->HandleAutocompleteResults(*autocomplete_controller_->providers()); 1030 instant->HandleAutocompleteResults(*autocomplete_controller_->providers());
999 } 1031 }
1000 1032
1001 bool OmniboxEditModel::query_in_progress() const { 1033 bool OmniboxEditModel::query_in_progress() const {
1002 return !autocomplete_controller_->done(); 1034 return !autocomplete_controller_->done();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1048 CHECK(!result.empty()); 1080 CHECK(!result.empty());
1049 CHECK(popup_->selected_line() < result.size()); 1081 CHECK(popup_->selected_line() < result.size());
1050 *match = result.match_at(popup_->selected_line()); 1082 *match = result.match_at(popup_->selected_line());
1051 } 1083 }
1052 if (alternate_nav_url && popup_->manually_selected_match().empty()) 1084 if (alternate_nav_url && popup_->manually_selected_match().empty())
1053 *alternate_nav_url = result.alternate_nav_url(); 1085 *alternate_nav_url = result.alternate_nav_url();
1054 } 1086 }
1055 1087
1056 void OmniboxEditModel::GetInfoForCurrentText(AutocompleteMatch* match, 1088 void OmniboxEditModel::GetInfoForCurrentText(AutocompleteMatch* match,
1057 GURL* alternate_nav_url) const { 1089 GURL* alternate_nav_url) const {
1058 if (popup_->IsOpen() || query_in_progress()) { 1090 // If there's temporary text and it has been set by Instant, we won't find it
1091 // in the popup model, so classify the text anew.
1092 if ((popup_->IsOpen() || query_in_progress()) &&
1093 !is_temporary_text_set_by_instant_) {
1059 InfoForCurrentSelection(match, alternate_nav_url); 1094 InfoForCurrentSelection(match, alternate_nav_url);
1060 } else { 1095 } else {
1061 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify( 1096 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(
1062 UserTextFromDisplayText(view_->GetText()), GetDesiredTLD(), 1097 UserTextFromDisplayText(view_->GetText()), GetDesiredTLD(),
1063 KeywordIsSelected(), true, match, alternate_nav_url); 1098 KeywordIsSelected(), true, match, alternate_nav_url);
1064 } 1099 }
1065 } 1100 }
1066 1101
1067 void OmniboxEditModel::RevertTemporaryText(bool revert_popup) { 1102 void OmniboxEditModel::RevertTemporaryText(bool revert_popup) {
1068 // The user typed something, then selected a different item. Restore the 1103 // The user typed something, then selected a different item. Restore the
1069 // text they typed and change back to the default item. 1104 // text they typed and change back to the default item.
1070 // NOTE: This purposefully does not reset paste_state_. 1105 // NOTE: This purposefully does not reset paste_state_.
1071 just_deleted_text_ = false; 1106 just_deleted_text_ = false;
1072 has_temporary_text_ = false; 1107 has_temporary_text_ = false;
1108 is_temporary_text_set_by_instant_ = false;
1073 if (revert_popup) 1109 if (revert_popup)
1074 popup_->ResetToDefaultMatch(); 1110 popup_->ResetToDefaultMatch();
1075 view_->OnRevertTemporaryText(); 1111 view_->OnRevertTemporaryText();
1076 } 1112 }
1077 1113
1078 bool OmniboxEditModel::MaybeAcceptKeywordBySpace(const string16& new_text) { 1114 bool OmniboxEditModel::MaybeAcceptKeywordBySpace(const string16& new_text) {
1079 size_t keyword_length = new_text.length() - 1; 1115 size_t keyword_length = new_text.length() - 1;
1080 return (paste_state_ == NONE) && is_keyword_hint_ && !keyword_.empty() && 1116 return (paste_state_ == NONE) && is_keyword_hint_ && !keyword_.empty() &&
1081 inline_autocomplete_text_.empty() && 1117 inline_autocomplete_text_.empty() &&
1082 (keyword_.length() == keyword_length) && 1118 (keyword_.length() == keyword_length) &&
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 } 1260 }
1225 1261
1226 void OmniboxEditModel::ClassifyStringForPasteAndGo( 1262 void OmniboxEditModel::ClassifyStringForPasteAndGo(
1227 const string16& text, 1263 const string16& text,
1228 AutocompleteMatch* match, 1264 AutocompleteMatch* match,
1229 GURL* alternate_nav_url) const { 1265 GURL* alternate_nav_url) const {
1230 DCHECK(match); 1266 DCHECK(match);
1231 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(text, 1267 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(text,
1232 string16(), false, false, match, alternate_nav_url); 1268 string16(), false, false, match, alternate_nav_url);
1233 } 1269 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698