Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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_) && |
| 888 DisplayTextFromUserText(user_text_).length())) | 888 inline_autocomplete_text_.empty()) { |
| 889 view_->SetWindowTextAndCaretPos(DisplayTextFromUserText(user_text_), 0, | |
|
Peter Kasting
2012/10/02 21:52:02
This still feels kind of wrong to me.
Where does
Joe Thomas
2012/10/02 22:11:34
The existing code which changes the display text i
Peter Kasting
2012/10/02 22:38:28
This just doesn't seem like the right place to be
Joe Thomas
2012/10/03 01:59:47
I doubt I completely understand your logic from yo
Peter Kasting
2012/10/03 03:01:01
Yes, I understood all that.
I've just spent anoth
Joe Thomas
2012/10/03 05:41:12
Thanks for the detailed review. I will make the re
| |
| 890 false, true); | |
| 889 call_controller_onchanged = false; | 891 call_controller_onchanged = false; |
| 892 } else if (view_->OnInlineAutocompleteTextMaybeChanged( | |
| 893 DisplayTextFromUserText(user_text_ + inline_autocomplete_text_), | |
| 894 DisplayTextFromUserText(user_text_).length())) { | |
| 895 call_controller_onchanged = false; | |
| 896 } | |
| 890 | 897 |
| 891 // If |has_temporary_text_| is true, then we previously had a manual selection | 898 // 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 | 899 // 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. | 900 // 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 | 901 // In this case, we've already reverted the popup to the default match, so we |
| 895 // need to revert ourselves as well. | 902 // need to revert ourselves as well. |
| 896 if (has_temporary_text_) { | 903 if (has_temporary_text_) { |
| 897 RevertTemporaryText(false); | 904 RevertTemporaryText(false); |
| 898 call_controller_onchanged = false; | 905 call_controller_onchanged = false; |
| 899 } | 906 } |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1265 } | 1272 } |
| 1266 | 1273 |
| 1267 void OmniboxEditModel::ClassifyStringForPasteAndGo( | 1274 void OmniboxEditModel::ClassifyStringForPasteAndGo( |
| 1268 const string16& text, | 1275 const string16& text, |
| 1269 AutocompleteMatch* match, | 1276 AutocompleteMatch* match, |
| 1270 GURL* alternate_nav_url) const { | 1277 GURL* alternate_nav_url) const { |
| 1271 DCHECK(match); | 1278 DCHECK(match); |
| 1272 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(text, | 1279 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(text, |
| 1273 string16(), false, false, match, alternate_nav_url); | 1280 string16(), false, false, match, alternate_nav_url); |
| 1274 } | 1281 } |
| OLD | NEW |