OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
481 paste_state_ = NONE; | 481 paste_state_ = NONE; |
482 | 482 |
483 // Like typing, killing focus "accepts" the temporary text as the user | 483 // Like typing, killing focus "accepts" the temporary text as the user |
484 // text, because it makes little sense to have temporary text when the | 484 // text, because it makes little sense to have temporary text when the |
485 // popup is closed. | 485 // popup is closed. |
486 InternalSetUserText(UserTextFromDisplayText(view_->GetText())); | 486 InternalSetUserText(UserTextFromDisplayText(view_->GetText())); |
487 has_temporary_text_ = false; | 487 has_temporary_text_ = false; |
488 } | 488 } |
489 | 489 |
490 bool AutocompleteEditModel::OnEscapeKeyPressed() { | 490 bool AutocompleteEditModel::OnEscapeKeyPressed() { |
491 if (has_temporary_text_) { | 491 if (has_temporary_text_ && popup_->IsOpen()) { |
Peter Kasting
2011/01/21 23:58:15
It should be an invariant here that the popup is o
| |
492 AutocompleteMatch match; | 492 AutocompleteMatch match; |
493 popup_->InfoForCurrentSelection(&match, NULL); | 493 popup_->InfoForCurrentSelection(&match, NULL); |
494 if (match.destination_url != original_url_) { | 494 if (match.destination_url != original_url_) { |
495 // The user typed something, then selected a different item. Restore the | 495 // The user typed something, then selected a different item. Restore the |
496 // text they typed and change back to the default item. | 496 // text they typed and change back to the default item. |
497 // NOTE: This purposefully does not reset paste_state_. | 497 // NOTE: This purposefully does not reset paste_state_. |
498 just_deleted_text_ = false; | 498 just_deleted_text_ = false; |
499 has_temporary_text_ = false; | 499 has_temporary_text_ = false; |
500 popup_->ResetToDefaultMatch(); | 500 popup_->ResetToDefaultMatch(); |
501 view_->OnRevertTemporaryText(); | 501 view_->OnRevertTemporaryText(); |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
793 // static | 793 // static |
794 bool AutocompleteEditModel::IsSpaceCharForAcceptingKeyword(wchar_t c) { | 794 bool AutocompleteEditModel::IsSpaceCharForAcceptingKeyword(wchar_t c) { |
795 switch (c) { | 795 switch (c) { |
796 case 0x0020: // Space | 796 case 0x0020: // Space |
797 case 0x3000: // Ideographic Space | 797 case 0x3000: // Ideographic Space |
798 return true; | 798 return true; |
799 default: | 799 default: |
800 return false; | 800 return false; |
801 } | 801 } |
802 } | 802 } |
OLD | NEW |