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

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

Issue 10837240: Search state transitions not working (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: OVERRIDE 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/search/search_delegate_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 961 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 } 972 }
973 973
974 if (popup_->IsOpen()) { 974 if (popup_->IsOpen()) {
975 PopupBoundsChangedTo(popup_->view()->GetTargetBounds()); 975 PopupBoundsChangedTo(popup_->view()->GetTargetBounds());
976 } else if (was_open) { 976 } else if (was_open) {
977 // Accepts the temporary text as the user text, because it makes little 977 // Accepts the temporary text as the user text, because it makes little
978 // sense to have temporary text when the popup is closed. 978 // sense to have temporary text when the popup is closed.
979 InternalSetUserText(UserTextFromDisplayText(view_->GetText())); 979 InternalSetUserText(UserTextFromDisplayText(view_->GetText()));
980 has_temporary_text_ = false; 980 has_temporary_text_ = false;
981 PopupBoundsChangedTo(gfx::Rect()); 981 PopupBoundsChangedTo(gfx::Rect());
982 NotifySearchTabHelper();
982 } 983 }
983 } 984 }
984 985
985 bool OmniboxEditModel::query_in_progress() const { 986 bool OmniboxEditModel::query_in_progress() const {
986 return !autocomplete_controller_->done(); 987 return !autocomplete_controller_->done();
987 } 988 }
988 989
989 void OmniboxEditModel::InternalSetUserText(const string16& text) { 990 void OmniboxEditModel::InternalSetUserText(const string16& text) {
990 user_text_ = text; 991 user_text_ = text;
991 just_deleted_text_ = false; 992 just_deleted_text_ = false;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 string16 keyword; 1095 string16 keyword;
1095 TrimWhitespace(new_text.substr(0, space_position), TRIM_LEADING, &keyword); 1096 TrimWhitespace(new_text.substr(0, space_position), TRIM_LEADING, &keyword);
1096 return !keyword.empty() && 1097 return !keyword.empty() &&
1097 !autocomplete_controller_->keyword_provider()-> 1098 !autocomplete_controller_->keyword_provider()->
1098 GetKeywordForText(keyword).empty(); 1099 GetKeywordForText(keyword).empty();
1099 } 1100 }
1100 1101
1101 void OmniboxEditModel::NotifySearchTabHelper() { 1102 void OmniboxEditModel::NotifySearchTabHelper() {
1102 if (controller_->GetTabContents()) { 1103 if (controller_->GetTabContents()) {
1103 controller_->GetTabContents()->search_tab_helper()-> 1104 controller_->GetTabContents()->search_tab_helper()->
1104 OmniboxEditModelChanged(this); 1105 OmniboxEditModelChanged(user_input_in_progress_, !in_revert_);
1105 } 1106 }
1106 } 1107 }
1107 1108
1108 bool OmniboxEditModel::DoInstant( 1109 bool OmniboxEditModel::DoInstant(
1109 const AutocompleteMatch& match, 1110 const AutocompleteMatch& match,
1110 string16* suggested_text, 1111 string16* suggested_text,
1111 InstantCompleteBehavior* complete_behavior) { 1112 InstantCompleteBehavior* complete_behavior) {
1112 DCHECK(suggested_text); 1113 DCHECK(suggested_text);
1113 DCHECK(complete_behavior); 1114 DCHECK(complete_behavior);
1114 1115
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1212 } 1213 }
1213 1214
1214 void OmniboxEditModel::ClassifyStringForPasteAndGo( 1215 void OmniboxEditModel::ClassifyStringForPasteAndGo(
1215 const string16& text, 1216 const string16& text,
1216 AutocompleteMatch* match, 1217 AutocompleteMatch* match,
1217 GURL* alternate_nav_url) const { 1218 GURL* alternate_nav_url) const {
1218 DCHECK(match); 1219 DCHECK(match);
1219 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(text, 1220 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(text,
1220 string16(), false, false, match, alternate_nav_url); 1221 string16(), false, false, match, alternate_nav_url);
1221 } 1222 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/search/search_delegate_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698