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 "ui/views/controls/textfield/textfield.h" | 5 #include "ui/views/controls/textfield/textfield.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "ui/accessibility/ax_view_state.h" | 10 #include "ui/accessibility/ax_view_state.h" |
(...skipping 1200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1211 case IDS_MOVE_TO_END_OF_LINE: | 1211 case IDS_MOVE_TO_END_OF_LINE: |
1212 case IDS_MOVE_TO_END_OF_LINE_AND_MODIFY_SELECTION: | 1212 case IDS_MOVE_TO_END_OF_LINE_AND_MODIFY_SELECTION: |
1213 return true; | 1213 return true; |
1214 default: | 1214 default: |
1215 return false; | 1215 return false; |
1216 } | 1216 } |
1217 } | 1217 } |
1218 | 1218 |
1219 bool Textfield::GetAcceleratorForCommandId(int command_id, | 1219 bool Textfield::GetAcceleratorForCommandId(int command_id, |
1220 ui::Accelerator* accelerator) { | 1220 ui::Accelerator* accelerator) { |
1221 return false; | 1221 switch (command_id) { |
| 1222 case IDS_APP_UNDO: |
| 1223 *accelerator = ui::Accelerator(ui::VKEY_Z, ui::EF_CONTROL_DOWN); |
| 1224 return true; |
| 1225 |
| 1226 case IDS_APP_CUT: |
| 1227 *accelerator = ui::Accelerator(ui::VKEY_X, ui::EF_CONTROL_DOWN); |
| 1228 return true; |
| 1229 |
| 1230 case IDS_APP_COPY: |
| 1231 *accelerator = ui::Accelerator(ui::VKEY_C, ui::EF_CONTROL_DOWN); |
| 1232 return true; |
| 1233 |
| 1234 case IDS_APP_PASTE: |
| 1235 *accelerator = ui::Accelerator(ui::VKEY_V, ui::EF_CONTROL_DOWN); |
| 1236 return true; |
| 1237 |
| 1238 case IDS_APP_SELECT_ALL: |
| 1239 *accelerator = ui::Accelerator(ui::VKEY_A, ui::EF_CONTROL_DOWN); |
| 1240 return true; |
| 1241 |
| 1242 default: |
| 1243 return false; |
| 1244 } |
1222 } | 1245 } |
1223 | 1246 |
1224 void Textfield::ExecuteCommand(int command_id, int event_flags) { | 1247 void Textfield::ExecuteCommand(int command_id, int event_flags) { |
1225 DestroyTouchSelection(); | 1248 DestroyTouchSelection(); |
1226 if (!IsCommandIdEnabled(command_id)) | 1249 if (!IsCommandIdEnabled(command_id)) |
1227 return; | 1250 return; |
1228 | 1251 |
1229 bool text_changed = false; | 1252 bool text_changed = false; |
1230 bool cursor_changed = false; | 1253 bool cursor_changed = false; |
1231 bool rtl = GetTextDirection() == base::i18n::RIGHT_TO_LEFT; | 1254 bool rtl = GetTextDirection() == base::i18n::RIGHT_TO_LEFT; |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1842 const size_t length = selection_clipboard_text.length(); | 1865 const size_t length = selection_clipboard_text.length(); |
1843 range = gfx::Range(range.start() + length, range.end() + length); | 1866 range = gfx::Range(range.start() + length, range.end() + length); |
1844 } | 1867 } |
1845 model_->MoveCursorTo(gfx::SelectionModel(range, affinity)); | 1868 model_->MoveCursorTo(gfx::SelectionModel(range, affinity)); |
1846 UpdateAfterChange(true, true); | 1869 UpdateAfterChange(true, true); |
1847 OnAfterUserAction(); | 1870 OnAfterUserAction(); |
1848 } | 1871 } |
1849 } | 1872 } |
1850 | 1873 |
1851 } // namespace views | 1874 } // namespace views |
OLD | NEW |