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

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

Issue 11034019: Cursor jumps to end of omnibox when activating keyword mode via inserted space (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 2 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
« no previous file with comments | « AUTHORS ('k') | no next file » | 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 865 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 // pressed, even though maybe it isn't any more. There is no obvious 876 // pressed, even though maybe it isn't any more. There is no obvious
877 // right answer here :( 877 // right answer here :(
878 } 878 }
879 view_->OnTemporaryTextMaybeChanged(DisplayTextFromUserText(text), 879 view_->OnTemporaryTextMaybeChanged(DisplayTextFromUserText(text),
880 save_original_selection); 880 save_original_selection);
881 return; 881 return;
882 } 882 }
883 883
884 bool call_controller_onchanged = true; 884 bool call_controller_onchanged = true;
885 inline_autocomplete_text_ = text; 885 inline_autocomplete_text_ = text;
886 if (view_->OnInlineAutocompleteTextMaybeChanged( 886 if (KeywordIsSelected() &&
887 DisplayTextFromUserText(user_text_ + inline_autocomplete_text_), 887 view_->GetText() != DisplayTextFromUserText(user_text_)) {
Peter Kasting 2012/10/02 07:37:12 Does this do the right thing in cases where we hav
Joe Thomas 2012/10/02 18:39:23 When keyword search mode is activated, AFAIK there
Peter Kasting 2012/10/02 18:42:35 We can definitely inline autocomplete while in key
Joe Thomas 2012/10/02 18:57:24 Yes, you are right. The patch breaks that usecase.
888 DisplayTextFromUserText(user_text_).length())) 888 view_->SetWindowTextAndCaretPos(DisplayTextFromUserText(user_text_), 0,
889 false, true);
889 call_controller_onchanged = false; 890 call_controller_onchanged = false;
891 } else if (view_->OnInlineAutocompleteTextMaybeChanged(
892 DisplayTextFromUserText(user_text_ + inline_autocomplete_text_),
893 DisplayTextFromUserText(user_text_).length())) {
894 call_controller_onchanged = false;
895 }
890 896
891 // If |has_temporary_text_| is true, then we previously had a manual selection 897 // If |has_temporary_text_| is true, then we previously had a manual selection
892 // but now don't (or |destination_for_temporary_text_change| would have been 898 // but now don't (or |destination_for_temporary_text_change| would have been
893 // non-NULL). This can happen when deleting the selected item in the popup. 899 // non-NULL). This can happen when deleting the selected item in the popup.
894 // In this case, we've already reverted the popup to the default match, so we 900 // In this case, we've already reverted the popup to the default match, so we
895 // need to revert ourselves as well. 901 // need to revert ourselves as well.
896 if (has_temporary_text_) { 902 if (has_temporary_text_) {
897 RevertTemporaryText(false); 903 RevertTemporaryText(false);
898 call_controller_onchanged = false; 904 call_controller_onchanged = false;
899 } 905 }
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
1265 } 1271 }
1266 1272
1267 void OmniboxEditModel::ClassifyStringForPasteAndGo( 1273 void OmniboxEditModel::ClassifyStringForPasteAndGo(
1268 const string16& text, 1274 const string16& text,
1269 AutocompleteMatch* match, 1275 AutocompleteMatch* match,
1270 GURL* alternate_nav_url) const { 1276 GURL* alternate_nav_url) const {
1271 DCHECK(match); 1277 DCHECK(match);
1272 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(text, 1278 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(text,
1273 string16(), false, false, match, alternate_nav_url); 1279 string16(), false, false, match, alternate_nav_url);
1274 } 1280 }
OLDNEW
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698