| 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 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 case ui::TextEditCommand::MOVE_UP: | 818 case ui::TextEditCommand::MOVE_UP: |
| 819 case ui::TextEditCommand::MOVE_DOWN: | 819 case ui::TextEditCommand::MOVE_DOWN: |
| 820 return !read_only(); | 820 return !read_only(); |
| 821 case ui::TextEditCommand::PASTE: | 821 case ui::TextEditCommand::PASTE: |
| 822 return !read_only() && !GetClipboardText().empty(); | 822 return !read_only() && !GetClipboardText().empty(); |
| 823 default: | 823 default: |
| 824 return Textfield::IsTextEditCommandEnabled(command); | 824 return Textfield::IsTextEditCommandEnabled(command); |
| 825 } | 825 } |
| 826 } | 826 } |
| 827 | 827 |
| 828 void OmniboxViewViews::ExecuteTextEditCommand(ui::TextEditCommand command) { | 828 bool OmniboxViewViews::ExecuteTextEditCommandImpl(ui::TextEditCommand command) { |
| 829 // In the base class, touch text selection is deactivated when a command is | |
| 830 // executed. Since we are not always calling the base class implementation | |
| 831 // here, we need to deactivate touch text selection here, too. | |
| 832 DestroyTouchSelection(); | |
| 833 | |
| 834 if (!IsTextEditCommandEnabled(command)) | |
| 835 return; | |
| 836 | |
| 837 switch (command) { | 829 switch (command) { |
| 838 case ui::TextEditCommand::MOVE_UP: | 830 case ui::TextEditCommand::MOVE_UP: |
| 839 model()->OnUpOrDownKeyPressed(-1); | 831 model()->OnUpOrDownKeyPressed(-1); |
| 840 break; | 832 return false; |
| 841 case ui::TextEditCommand::MOVE_DOWN: | 833 case ui::TextEditCommand::MOVE_DOWN: |
| 842 model()->OnUpOrDownKeyPressed(1); | 834 model()->OnUpOrDownKeyPressed(1); |
| 843 break; | 835 return false; |
| 844 case ui::TextEditCommand::PASTE: | 836 case ui::TextEditCommand::PASTE: |
| 845 OnPaste(); | 837 OnPaste(); |
| 846 break; | 838 return true; |
| 847 default: | 839 default: |
| 848 Textfield::ExecuteTextEditCommand(command); | 840 return Textfield::ExecuteTextEditCommandImpl(command); |
| 849 break; | |
| 850 } | 841 } |
| 851 } | 842 } |
| 852 | 843 |
| 853 #if defined(OS_CHROMEOS) | 844 #if defined(OS_CHROMEOS) |
| 854 void OmniboxViewViews::CandidateWindowOpened( | 845 void OmniboxViewViews::CandidateWindowOpened( |
| 855 chromeos::input_method::InputMethodManager* manager) { | 846 chromeos::input_method::InputMethodManager* manager) { |
| 856 ime_candidate_window_open_ = true; | 847 ime_candidate_window_open_ = true; |
| 857 } | 848 } |
| 858 | 849 |
| 859 void OmniboxViewViews::CandidateWindowClosed( | 850 void OmniboxViewViews::CandidateWindowClosed( |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1053 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO); | 1044 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO); |
| 1054 | 1045 |
| 1055 menu_contents->AddSeparator(ui::NORMAL_SEPARATOR); | 1046 menu_contents->AddSeparator(ui::NORMAL_SEPARATOR); |
| 1056 | 1047 |
| 1057 // Minor note: We use IDC_ for command id here while the underlying textfield | 1048 // Minor note: We use IDC_ for command id here while the underlying textfield |
| 1058 // is using IDS_ for all its command ids. This is because views cannot depend | 1049 // is using IDS_ for all its command ids. This is because views cannot depend |
| 1059 // on IDC_ for now. | 1050 // on IDC_ for now. |
| 1060 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, | 1051 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, |
| 1061 IDS_EDIT_SEARCH_ENGINES); | 1052 IDS_EDIT_SEARCH_ENGINES); |
| 1062 } | 1053 } |
| OLD | NEW |