OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/property_bag.h" | 7 #include "base/property_bag.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 if (model_->popup_model()->IsOpen()) | 232 if (model_->popup_model()->IsOpen()) |
233 model_->popup_model()->TryDeletingCurrentItem(); | 233 model_->popup_model()->TryDeletingCurrentItem(); |
234 } else if (!handled && event.key_code() == ui::VKEY_UP) { | 234 } else if (!handled && event.key_code() == ui::VKEY_UP) { |
235 model_->OnUpOrDownKeyPressed(-1); | 235 model_->OnUpOrDownKeyPressed(-1); |
236 handled = true; | 236 handled = true; |
237 } else if (!handled && event.key_code() == ui::VKEY_DOWN) { | 237 } else if (!handled && event.key_code() == ui::VKEY_DOWN) { |
238 model_->OnUpOrDownKeyPressed(1); | 238 model_->OnUpOrDownKeyPressed(1); |
239 handled = true; | 239 handled = true; |
240 } else if (!handled && | 240 } else if (!handled && |
241 event.key_code() == ui::VKEY_TAB && | 241 event.key_code() == ui::VKEY_TAB && |
242 !event.IsShiftDown() && | |
243 !event.IsControlDown()) { | 242 !event.IsControlDown()) { |
244 if (model_->is_keyword_hint()) { | 243 if (model_->is_keyword_hint() && !event.IsShiftDown()) { |
245 handled = model_->AcceptKeyword(); | 244 handled = model_->AcceptKeyword(); |
| 245 } else if (model_->popup_model()->IsOpen()) { |
| 246 if (event.IsShiftDown() && |
| 247 model_->popup_model()->selected_line_state() == |
| 248 AutocompletePopupModel::KEYWORD) { |
| 249 model_->ClearKeyword(GetText()); |
| 250 } else { |
| 251 model_->OnUpOrDownKeyPressed(event.IsShiftDown() ? -1 : 1); |
| 252 } |
| 253 handled = true; |
246 } else { | 254 } else { |
247 string16::size_type start = 0; | 255 string16::size_type start = 0; |
248 string16::size_type end = 0; | 256 string16::size_type end = 0; |
249 size_t length = GetTextLength(); | 257 size_t length = GetTextLength(); |
250 GetSelectionBounds(&start, &end); | 258 GetSelectionBounds(&start, &end); |
251 if (start != end || start < length) { | 259 if (start != end || start < length) { |
252 OnBeforePossibleChange(); | 260 OnBeforePossibleChange(); |
253 textfield_->SelectRange(ui::Range(length, length)); | 261 textfield_->SelectRange(ui::Range(length, length)); |
254 OnAfterPossibleChange(); | 262 OnAfterPossibleChange(); |
255 handled = true; | 263 handled = true; |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 OmniboxViewViews* omnibox_view = new OmniboxViewViews(controller, | 818 OmniboxViewViews* omnibox_view = new OmniboxViewViews(controller, |
811 toolbar_model, | 819 toolbar_model, |
812 profile, | 820 profile, |
813 command_updater, | 821 command_updater, |
814 popup_window_mode, | 822 popup_window_mode, |
815 location_bar); | 823 location_bar); |
816 omnibox_view->Init(); | 824 omnibox_view->Init(); |
817 return omnibox_view; | 825 return omnibox_view; |
818 } | 826 } |
819 #endif | 827 #endif |
OLD | NEW |