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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 if (model_->popup_model()->IsOpen()) | 222 if (model_->popup_model()->IsOpen()) |
223 model_->popup_model()->TryDeletingCurrentItem(); | 223 model_->popup_model()->TryDeletingCurrentItem(); |
224 } else if (!handled && event.key_code() == ui::VKEY_UP) { | 224 } else if (!handled && event.key_code() == ui::VKEY_UP) { |
225 model_->OnUpOrDownKeyPressed(-1); | 225 model_->OnUpOrDownKeyPressed(-1); |
226 handled = true; | 226 handled = true; |
227 } else if (!handled && event.key_code() == ui::VKEY_DOWN) { | 227 } else if (!handled && event.key_code() == ui::VKEY_DOWN) { |
228 model_->OnUpOrDownKeyPressed(1); | 228 model_->OnUpOrDownKeyPressed(1); |
229 handled = true; | 229 handled = true; |
230 } else if (!handled && | 230 } else if (!handled && |
231 event.key_code() == ui::VKEY_TAB && | 231 event.key_code() == ui::VKEY_TAB && |
232 !event.IsShiftDown() && | |
233 !event.IsControlDown()) { | 232 !event.IsControlDown()) { |
234 if (model_->is_keyword_hint()) { | 233 if (model_->is_keyword_hint() && !event.IsShiftDown()) { |
235 handled = model_->AcceptKeyword(); | 234 handled = model_->AcceptKeyword(); |
| 235 } else if (model_->popup_model()->IsOpen()) { |
| 236 if (event.IsShiftDown() && |
| 237 model_->popup_model()->selected_line_state() == |
| 238 AutocompletePopupModel::KEYWORD) { |
| 239 model_->ClearKeyword(GetText()); |
| 240 } else { |
| 241 model_->OnUpOrDownKeyPressed(event.IsShiftDown() ? -1 : 1); |
| 242 } |
| 243 handled = true; |
236 } else { | 244 } else { |
237 string16::size_type start = 0; | 245 string16::size_type start = 0; |
238 string16::size_type end = 0; | 246 string16::size_type end = 0; |
239 size_t length = GetTextLength(); | 247 size_t length = GetTextLength(); |
240 GetSelectionBounds(&start, &end); | 248 GetSelectionBounds(&start, &end); |
241 if (start != end || start < length) { | 249 if (start != end || start < length) { |
242 OnBeforePossibleChange(); | 250 OnBeforePossibleChange(); |
243 textfield_->SelectRange(ui::Range(length, length)); | 251 textfield_->SelectRange(ui::Range(length, length)); |
244 OnAfterPossibleChange(); | 252 OnAfterPossibleChange(); |
245 handled = true; | 253 handled = true; |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 AutocompletePopupView* OmniboxViewViews::CreatePopupView( | 715 AutocompletePopupView* OmniboxViewViews::CreatePopupView( |
708 View* location_bar) { | 716 View* location_bar) { |
709 #if defined(TOUCH_UI) | 717 #if defined(TOUCH_UI) |
710 typedef TouchAutocompletePopupContentsView AutocompleteContentsView; | 718 typedef TouchAutocompletePopupContentsView AutocompleteContentsView; |
711 #else | 719 #else |
712 typedef AutocompletePopupContentsView AutocompleteContentsView; | 720 typedef AutocompletePopupContentsView AutocompleteContentsView; |
713 #endif | 721 #endif |
714 return new AutocompleteContentsView(gfx::Font(), this, model_.get(), | 722 return new AutocompleteContentsView(gfx::Font(), this, model_.get(), |
715 location_bar); | 723 location_bar); |
716 } | 724 } |
OLD | NEW |