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/ui/views/omnibox/omnibox_view_win.h" | 5 #include "chrome/browser/ui/views/omnibox/omnibox_view_win.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <locale> | 8 #include <locale> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 2045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2056 } | 2056 } |
2057 | 2057 |
2058 // We're showing a keyword and the user pressed backspace at the beginning | 2058 // We're showing a keyword and the user pressed backspace at the beginning |
2059 // of the text. Delete the selected keyword. | 2059 // of the text. Delete the selected keyword. |
2060 ScopedFreeze freeze(this, GetTextObjectModel()); | 2060 ScopedFreeze freeze(this, GetTextObjectModel()); |
2061 model_->ClearKeyword(GetText()); | 2061 model_->ClearKeyword(GetText()); |
2062 return true; | 2062 return true; |
2063 } | 2063 } |
2064 | 2064 |
2065 case VK_TAB: { | 2065 case VK_TAB: { |
2066 if (model_->is_keyword_hint()) { | 2066 const bool shift_pressed = GetKeyState(VK_SHIFT) < 0; |
| 2067 if (model_->is_keyword_hint() && !shift_pressed) { |
2067 // Accept the keyword. | 2068 // Accept the keyword. |
2068 ScopedFreeze freeze(this, GetTextObjectModel()); | 2069 ScopedFreeze freeze(this, GetTextObjectModel()); |
2069 model_->AcceptKeyword(); | 2070 model_->AcceptKeyword(); |
2070 } else if (!IsCaretAtEnd()) { | 2071 } else if (shift_pressed && |
2071 ScopedFreeze freeze(this, GetTextObjectModel()); | 2072 model_->popup_model()->selected_line_state() == |
2072 OnBeforePossibleChange(); | 2073 AutocompletePopupModel::KEYWORD) { |
2073 PlaceCaretAt(GetTextLength()); | 2074 model_->ClearKeyword(GetText()); |
2074 OnAfterPossibleChange(); | |
2075 } else { | 2075 } else { |
2076 model_->CommitSuggestedText(true); | 2076 model_->OnUpOrDownKeyPressed(shift_pressed ? -count : count); |
2077 } | 2077 } |
2078 return true; | 2078 return true; |
2079 } | 2079 } |
2080 | 2080 |
2081 case 0xbb: // Ctrl-'='. Triggers subscripting (even in plain text mode). | 2081 case 0xbb: // Ctrl-'='. Triggers subscripting (even in plain text mode). |
2082 // We don't use VK_OEM_PLUS in case the macro isn't defined. | 2082 // We don't use VK_OEM_PLUS in case the macro isn't defined. |
2083 // (e.g., we don't have this symbol in embeded environment). | 2083 // (e.g., we don't have this symbol in embeded environment). |
2084 return true; | 2084 return true; |
2085 | 2085 |
2086 default: | 2086 default: |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2688 return omnibox_view; | 2688 return omnibox_view; |
2689 } | 2689 } |
2690 return new OmniboxViewWin(controller, | 2690 return new OmniboxViewWin(controller, |
2691 toolbar_model, | 2691 toolbar_model, |
2692 location_bar, | 2692 location_bar, |
2693 command_updater, | 2693 command_updater, |
2694 popup_window_mode, | 2694 popup_window_mode, |
2695 location_bar); | 2695 location_bar); |
2696 } | 2696 } |
2697 #endif | 2697 #endif |
OLD | NEW |