OLD | NEW |
---|---|
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/autocomplete/autocomplete_edit.h" | 5 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" | 9 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" |
10 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" | 10 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
449 // Save the original selection and URL so it can be reverted later. | 449 // Save the original selection and URL so it can be reverted later. |
450 has_temporary_text_ = true; | 450 has_temporary_text_ = true; |
451 original_url_ = popup_->URLsForCurrentSelection(NULL, NULL, NULL); | 451 original_url_ = popup_->URLsForCurrentSelection(NULL, NULL, NULL); |
452 original_keyword_ui_state_ = keyword_ui_state_; | 452 original_keyword_ui_state_ = keyword_ui_state_; |
453 } | 453 } |
454 view_->OnTemporaryTextMaybeChanged(DisplayTextFromUserText(text), | 454 view_->OnTemporaryTextMaybeChanged(DisplayTextFromUserText(text), |
455 save_original_selection); | 455 save_original_selection); |
456 return; | 456 return; |
457 } | 457 } |
458 | 458 |
459 // TODO(suzhe): It shouldn't affect inline autocomplete text at all. | |
Peter Kasting
2009/09/10 19:30:27
Nit: The substance here is fine, the grammar is a
| |
460 // Instead, the edit should deal with it separately in Observe(), and | |
461 // save and restore it properly around setting/resetting temporary text. | |
462 // | |
459 // Handle changes to inline autocomplete text. Don't make changes if the user | 463 // Handle changes to inline autocomplete text. Don't make changes if the user |
460 // is showing temporary text. Making display changes would be obviously | 464 // is showing temporary text. Making display changes would be obviously |
461 // wrong; making changes to the inline_autocomplete_text_ itself turns out to | 465 // wrong; making changes to the inline_autocomplete_text_ itself turns out to |
462 // be more subtlely wrong, because it means hitting esc will no longer revert | 466 // be more subtlely wrong, because it means hitting esc will no longer revert |
463 // to the original state before arrowing. | 467 // to the original state before arrowing. |
464 if (!has_temporary_text_) { | 468 if (!has_temporary_text_) { |
465 inline_autocomplete_text_ = text; | 469 inline_autocomplete_text_ = text; |
466 if (view_->OnInlineAutocompleteTextMaybeChanged( | 470 if (view_->OnInlineAutocompleteTextMaybeChanged( |
467 DisplayTextFromUserText(user_text_ + inline_autocomplete_text_), | 471 DisplayTextFromUserText(user_text_ + inline_autocomplete_text_), |
468 DisplayTextFromUserText(user_text_).length())) | 472 DisplayTextFromUserText(user_text_).length())) |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
618 // Get the URLs for the default match. | 622 // Get the URLs for the default match. |
619 const AutocompleteResult::const_iterator match = result.default_match(); | 623 const AutocompleteResult::const_iterator match = result.default_match(); |
620 if (transition) | 624 if (transition) |
621 *transition = match->transition; | 625 *transition = match->transition; |
622 if (is_history_what_you_typed_match) | 626 if (is_history_what_you_typed_match) |
623 *is_history_what_you_typed_match = match->is_history_what_you_typed_match; | 627 *is_history_what_you_typed_match = match->is_history_what_you_typed_match; |
624 if (alternate_nav_url) | 628 if (alternate_nav_url) |
625 *alternate_nav_url = result.alternate_nav_url(); | 629 *alternate_nav_url = result.alternate_nav_url(); |
626 return match->destination_url; | 630 return match->destination_url; |
627 } | 631 } |
OLD | NEW |