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_view_views.h" | 5 #include "chrome/browser/autocomplete/autocomplete_edit_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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 if (model_->popup_model()->IsOpen()) | 192 if (model_->popup_model()->IsOpen()) |
193 model_->popup_model()->TryDeletingCurrentItem(); | 193 model_->popup_model()->TryDeletingCurrentItem(); |
194 } else if (!handled && event.key_code() == ui::VKEY_UP) { | 194 } else if (!handled && event.key_code() == ui::VKEY_UP) { |
195 model_->OnUpOrDownKeyPressed(-1); | 195 model_->OnUpOrDownKeyPressed(-1); |
196 handled = true; | 196 handled = true; |
197 } else if (!handled && event.key_code() == ui::VKEY_DOWN) { | 197 } else if (!handled && event.key_code() == ui::VKEY_DOWN) { |
198 model_->OnUpOrDownKeyPressed(1); | 198 model_->OnUpOrDownKeyPressed(1); |
199 handled = true; | 199 handled = true; |
200 } else if (!handled && | 200 } else if (!handled && |
201 event.key_code() == ui::VKEY_TAB && | 201 event.key_code() == ui::VKEY_TAB && |
202 !event.IsShiftDown() && | |
203 !event.IsControlDown()) { | 202 !event.IsControlDown()) { |
204 if (model_->is_keyword_hint()) { | 203 if (model_->is_keyword_hint() && !event.IsShiftDown()) { |
205 handled = model_->AcceptKeyword(); | 204 handled = model_->AcceptKeyword(); |
| 205 } else if (model_->popup_model()->IsOpen()) { |
| 206 model_->OnUpOrDownKeyPressed(event.IsShiftDown() ? -1 : 1); |
| 207 handled = true; |
206 } else { | 208 } else { |
207 string16::size_type start = 0; | 209 string16::size_type start = 0; |
208 string16::size_type end = 0; | 210 string16::size_type end = 0; |
209 size_t length = GetTextLength(); | 211 size_t length = GetTextLength(); |
210 GetSelectionBounds(&start, &end); | 212 GetSelectionBounds(&start, &end); |
211 if (start != end || start < length) { | 213 if (start != end || start < length) { |
212 OnBeforePossibleChange(); | 214 OnBeforePossibleChange(); |
213 SelectRange(length, length); | 215 SelectRange(length, length); |
214 OnAfterPossibleChange(); | 216 OnAfterPossibleChange(); |
215 handled = true; | 217 handled = true; |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 AutocompletePopupView* AutocompleteEditViewViews::CreatePopupView( | 643 AutocompletePopupView* AutocompleteEditViewViews::CreatePopupView( |
642 Profile* profile, | 644 Profile* profile, |
643 const View* location_bar) { | 645 const View* location_bar) { |
644 #if defined(TOUCH_UI) | 646 #if defined(TOUCH_UI) |
645 return new TouchAutocompletePopupContentsView( | 647 return new TouchAutocompletePopupContentsView( |
646 #else | 648 #else |
647 return new AutocompletePopupContentsView( | 649 return new AutocompletePopupContentsView( |
648 #endif | 650 #endif |
649 gfx::Font(), this, model_.get(), profile, location_bar); | 651 gfx::Font(), this, model_.get(), profile, location_bar); |
650 } | 652 } |
OLD | NEW |