| 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 <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 // Skip processing of [Alt]+<num-pad digit> Unicode alt key codes. | 711 // Skip processing of [Alt]+<num-pad digit> Unicode alt key codes. |
| 712 // Otherwise, if num-lock is off, the events are handled as [Up], [Down], etc. | 712 // Otherwise, if num-lock is off, the events are handled as [Up], [Down], etc. |
| 713 if (event.IsUnicodeKeyCode()) | 713 if (event.IsUnicodeKeyCode()) |
| 714 return views::Textfield::OnKeyPressed(event); | 714 return views::Textfield::OnKeyPressed(event); |
| 715 | 715 |
| 716 const bool shift = event.IsShiftDown(); | 716 const bool shift = event.IsShiftDown(); |
| 717 const bool control = event.IsControlDown(); | 717 const bool control = event.IsControlDown(); |
| 718 const bool alt = event.IsAltDown() || event.IsAltGrDown(); | 718 const bool alt = event.IsAltDown() || event.IsAltGrDown(); |
| 719 switch (event.key_code()) { | 719 switch (event.key_code()) { |
| 720 case ui::VKEY_RETURN: | 720 case ui::VKEY_RETURN: |
| 721 model()->AcceptInput(alt ? NEW_FOREGROUND_TAB : CURRENT_TAB, false); | 721 model()->AcceptInput(alt ? WindowOpenDisposition::NEW_FOREGROUND_TAB |
| 722 : WindowOpenDisposition::CURRENT_TAB, |
| 723 false); |
| 722 return true; | 724 return true; |
| 723 case ui::VKEY_ESCAPE: | 725 case ui::VKEY_ESCAPE: |
| 724 return model()->OnEscapeKeyPressed(); | 726 return model()->OnEscapeKeyPressed(); |
| 725 case ui::VKEY_CONTROL: | 727 case ui::VKEY_CONTROL: |
| 726 model()->OnControlKeyChanged(true); | 728 model()->OnControlKeyChanged(true); |
| 727 break; | 729 break; |
| 728 case ui::VKEY_DELETE: | 730 case ui::VKEY_DELETE: |
| 729 if (shift && model()->popup_model()->IsOpen()) | 731 if (shift && model()->popup_model()->IsOpen()) |
| 730 model()->popup_model()->TryDeletingCurrentItem(); | 732 model()->popup_model()->TryDeletingCurrentItem(); |
| 731 break; | 733 break; |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1090 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO); | 1092 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO); |
| 1091 | 1093 |
| 1092 menu_contents->AddSeparator(ui::NORMAL_SEPARATOR); | 1094 menu_contents->AddSeparator(ui::NORMAL_SEPARATOR); |
| 1093 | 1095 |
| 1094 // Minor note: We use IDC_ for command id here while the underlying textfield | 1096 // Minor note: We use IDC_ for command id here while the underlying textfield |
| 1095 // is using IDS_ for all its command ids. This is because views cannot depend | 1097 // is using IDS_ for all its command ids. This is because views cannot depend |
| 1096 // on IDC_ for now. | 1098 // on IDC_ for now. |
| 1097 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, | 1099 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, |
| 1098 IDS_EDIT_SEARCH_ENGINES); | 1100 IDS_EDIT_SEARCH_ENGINES); |
| 1099 } | 1101 } |
| OLD | NEW |