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_views.h" | 5 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 } else if (!handled && event.key_code() == ui::VKEY_UP) { | 217 } else if (!handled && event.key_code() == ui::VKEY_UP) { |
218 model_->OnUpOrDownKeyPressed(-1); | 218 model_->OnUpOrDownKeyPressed(-1); |
219 handled = true; | 219 handled = true; |
220 } else if (!handled && event.key_code() == ui::VKEY_DOWN) { | 220 } else if (!handled && event.key_code() == ui::VKEY_DOWN) { |
221 model_->OnUpOrDownKeyPressed(1); | 221 model_->OnUpOrDownKeyPressed(1); |
222 handled = true; | 222 handled = true; |
223 } else if (!handled && | 223 } else if (!handled && |
224 event.key_code() == ui::VKEY_TAB && | 224 event.key_code() == ui::VKEY_TAB && |
225 !event.IsShiftDown() && | 225 !event.IsShiftDown() && |
226 !event.IsControlDown()) { | 226 !event.IsControlDown()) { |
227 if (model_->is_keyword_hint()) { | 227 if (model_->is_keyword_hint() && !event.IsShiftDown()) { |
228 handled = model_->AcceptKeyword(); | 228 handled = model_->AcceptKeyword(); |
| 229 } else if (model_->popup_model()->IsOpen()) { |
| 230 model_->OnUpOrDownKeyPressed(event.IsShiftDown() ? -1 : 1); |
| 231 handled = true; |
229 } else { | 232 } else { |
230 string16::size_type start = 0; | 233 string16::size_type start = 0; |
231 string16::size_type end = 0; | 234 string16::size_type end = 0; |
232 size_t length = GetTextLength(); | 235 size_t length = GetTextLength(); |
233 GetSelectionBounds(&start, &end); | 236 GetSelectionBounds(&start, &end); |
234 if (start != end || start < length) { | 237 if (start != end || start < length) { |
235 OnBeforePossibleChange(); | 238 OnBeforePossibleChange(); |
236 SelectRange(length, length); | 239 SelectRange(length, length); |
237 OnAfterPossibleChange(); | 240 OnAfterPossibleChange(); |
238 handled = true; | 241 handled = true; |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 Profile* profile, | 697 Profile* profile, |
695 const View* location_bar) { | 698 const View* location_bar) { |
696 #if defined(TOUCH_UI) | 699 #if defined(TOUCH_UI) |
697 typedef TouchAutocompletePopupContentsView AutocompleteContentsView; | 700 typedef TouchAutocompletePopupContentsView AutocompleteContentsView; |
698 #else | 701 #else |
699 typedef AutocompletePopupContentsView AutocompleteContentsView; | 702 typedef AutocompletePopupContentsView AutocompleteContentsView; |
700 #endif | 703 #endif |
701 return new AutocompleteContentsView( | 704 return new AutocompleteContentsView( |
702 gfx::Font(), this, model_.get(), profile, location_bar); | 705 gfx::Font(), this, model_.get(), profile, location_bar); |
703 } | 706 } |
OLD | NEW |