| 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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 } else if (!handled && event.key_code() == ui::VKEY_UP) { | 215 } else if (!handled && event.key_code() == ui::VKEY_UP) { |
| 216 model_->OnUpOrDownKeyPressed(-1); | 216 model_->OnUpOrDownKeyPressed(-1); |
| 217 handled = true; | 217 handled = true; |
| 218 } else if (!handled && event.key_code() == ui::VKEY_DOWN) { | 218 } else if (!handled && event.key_code() == ui::VKEY_DOWN) { |
| 219 model_->OnUpOrDownKeyPressed(1); | 219 model_->OnUpOrDownKeyPressed(1); |
| 220 handled = true; | 220 handled = true; |
| 221 } else if (!handled && | 221 } else if (!handled && |
| 222 event.key_code() == ui::VKEY_TAB && | 222 event.key_code() == ui::VKEY_TAB && |
| 223 !event.IsShiftDown() && | 223 !event.IsShiftDown() && |
| 224 !event.IsControlDown()) { | 224 !event.IsControlDown()) { |
| 225 if (model_->is_keyword_hint()) { | 225 if (model_->is_keyword_hint() && !event.IsShiftDown()) { |
| 226 handled = model_->AcceptKeyword(); | 226 handled = model_->AcceptKeyword(); |
| 227 } else if (model_->popup_model()->IsOpen()) { |
| 228 model_->OnUpOrDownKeyPressed(event.IsShiftDown() ? -1 : 1); |
| 229 handled = true; |
| 227 } else { | 230 } else { |
| 228 string16::size_type start = 0; | 231 string16::size_type start = 0; |
| 229 string16::size_type end = 0; | 232 string16::size_type end = 0; |
| 230 size_t length = GetTextLength(); | 233 size_t length = GetTextLength(); |
| 231 GetSelectionBounds(&start, &end); | 234 GetSelectionBounds(&start, &end); |
| 232 if (start != end || start < length) { | 235 if (start != end || start < length) { |
| 233 OnBeforePossibleChange(); | 236 OnBeforePossibleChange(); |
| 234 SelectRange(length, length); | 237 SelectRange(length, length); |
| 235 OnAfterPossibleChange(); | 238 OnAfterPossibleChange(); |
| 236 handled = true; | 239 handled = true; |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 Profile* profile, | 695 Profile* profile, |
| 693 const View* location_bar) { | 696 const View* location_bar) { |
| 694 #if defined(TOUCH_UI) | 697 #if defined(TOUCH_UI) |
| 695 typedef TouchAutocompletePopupContentsView AutocompleteContentsView; | 698 typedef TouchAutocompletePopupContentsView AutocompleteContentsView; |
| 696 #else | 699 #else |
| 697 typedef AutocompletePopupContentsView AutocompleteContentsView; | 700 typedef AutocompletePopupContentsView AutocompleteContentsView; |
| 698 #endif | 701 #endif |
| 699 return new AutocompleteContentsView( | 702 return new AutocompleteContentsView( |
| 700 gfx::Font(), this, model_.get(), profile, location_bar); | 703 gfx::Font(), this, model_.get(), profile, location_bar); |
| 701 } | 704 } |
| OLD | NEW |