OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "views/controls/textfield/native_textfield_win.h" | 5 #include "views/controls/textfield/native_textfield_win.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "app/clipboard/clipboard.h" | 9 #include "app/clipboard/clipboard.h" |
10 #include "app/clipboard/scoped_clipboard_writer.h" | 10 #include "app/clipboard/scoped_clipboard_writer.h" |
11 #include "app/keyboard_codes.h" | |
12 #include "app/l10n_util.h" | 11 #include "app/l10n_util.h" |
13 #include "app/l10n_util_win.h" | 12 #include "app/l10n_util_win.h" |
14 #include "app/win_util.h" | 13 #include "app/win_util.h" |
15 #include "base/i18n/rtl.h" | 14 #include "base/i18n/rtl.h" |
| 15 #include "base/keyboard_codes.h" |
16 #include "base/string_util.h" | 16 #include "base/string_util.h" |
17 #include "base/utf_string_conversions.h" | 17 #include "base/utf_string_conversions.h" |
18 #include "base/win_util.h" | 18 #include "base/win_util.h" |
19 #include "gfx/native_theme_win.h" | 19 #include "gfx/native_theme_win.h" |
20 #include "grit/app_strings.h" | 20 #include "grit/app_strings.h" |
21 #include "skia/ext/skia_utils_win.h" | 21 #include "skia/ext/skia_utils_win.h" |
22 #include "views/controls/label.h" | 22 #include "views/controls/label.h" |
23 #include "views/controls/menu/menu_win.h" | 23 #include "views/controls/menu/menu_win.h" |
24 #include "views/controls/menu/menu_2.h" | 24 #include "views/controls/menu/menu_2.h" |
25 #include "views/controls/native/native_view_host.h" | 25 #include "views/controls/native/native_view_host.h" |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 return false; | 306 return false; |
307 } | 307 } |
308 } | 308 } |
309 | 309 |
310 bool NativeTextfieldWin::GetAcceleratorForCommandId(int command_id, | 310 bool NativeTextfieldWin::GetAcceleratorForCommandId(int command_id, |
311 menus::Accelerator* accelerator) { | 311 menus::Accelerator* accelerator) { |
312 // The standard Ctrl-X, Ctrl-V and Ctrl-C are not defined as accelerators | 312 // The standard Ctrl-X, Ctrl-V and Ctrl-C are not defined as accelerators |
313 // anywhere so we need to check for them explicitly here. | 313 // anywhere so we need to check for them explicitly here. |
314 switch (command_id) { | 314 switch (command_id) { |
315 case IDS_APP_CUT: | 315 case IDS_APP_CUT: |
316 *accelerator = views::Accelerator(app::VKEY_X, false, true, false); | 316 *accelerator = views::Accelerator(base::VKEY_X, false, true, false); |
317 return true; | 317 return true; |
318 case IDS_APP_COPY: | 318 case IDS_APP_COPY: |
319 *accelerator = views::Accelerator(app::VKEY_C, false, true, false); | 319 *accelerator = views::Accelerator(base::VKEY_C, false, true, false); |
320 return true; | 320 return true; |
321 case IDS_APP_PASTE: | 321 case IDS_APP_PASTE: |
322 *accelerator = views::Accelerator(app::VKEY_V, false, true, false); | 322 *accelerator = views::Accelerator(base::VKEY_V, false, true, false); |
323 return true; | 323 return true; |
324 } | 324 } |
325 return container_view_->GetWidget()->GetAccelerator(command_id, accelerator); | 325 return container_view_->GetWidget()->GetAccelerator(command_id, accelerator); |
326 } | 326 } |
327 | 327 |
328 void NativeTextfieldWin::ExecuteCommand(int command_id) { | 328 void NativeTextfieldWin::ExecuteCommand(int command_id) { |
329 ScopedFreeze freeze(this, GetTextObjectModel()); | 329 ScopedFreeze freeze(this, GetTextObjectModel()); |
330 OnBeforePossibleChange(); | 330 OnBeforePossibleChange(); |
331 switch (command_id) { | 331 switch (command_id) { |
332 case IDS_APP_UNDO: Undo(); break; | 332 case IDS_APP_UNDO: Undo(); break; |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 Textfield::Controller* controller = textfield_->GetController(); | 861 Textfield::Controller* controller = textfield_->GetController(); |
862 bool handled = false; | 862 bool handled = false; |
863 if (controller) { | 863 if (controller) { |
864 handled = controller->HandleKeystroke(textfield_, | 864 handled = controller->HandleKeystroke(textfield_, |
865 Textfield::Keystroke(message, key, repeat_count, flags)); | 865 Textfield::Keystroke(message, key, repeat_count, flags)); |
866 } | 866 } |
867 | 867 |
868 if (!handled) { | 868 if (!handled) { |
869 OnBeforePossibleChange(); | 869 OnBeforePossibleChange(); |
870 | 870 |
871 if (key == app::VKEY_HOME || key == app::VKEY_END) { | 871 if (key == base::VKEY_HOME || key == base::VKEY_END) { |
872 // DefWindowProc() might reset the keyboard layout when it receives a | 872 // DefWindowProc() might reset the keyboard layout when it receives a |
873 // keydown event for VKEY_HOME or VKEY_END. When the window was created | 873 // keydown event for VKEY_HOME or VKEY_END. When the window was created |
874 // with WS_EX_LAYOUTRTL and the current keyboard layout is not a RTL one, | 874 // with WS_EX_LAYOUTRTL and the current keyboard layout is not a RTL one, |
875 // if the input text is pure LTR text, the layout changes to the first RTL | 875 // if the input text is pure LTR text, the layout changes to the first RTL |
876 // keyboard layout in keyboard layout queue; if the input text is | 876 // keyboard layout in keyboard layout queue; if the input text is |
877 // bidirectional text, the layout changes to the keyboard layout of the | 877 // bidirectional text, the layout changes to the keyboard layout of the |
878 // first RTL character in input text. When the window was created without | 878 // first RTL character in input text. When the window was created without |
879 // WS_EX_LAYOUTRTL and the current keyboard layout is not a LTR one, if | 879 // WS_EX_LAYOUTRTL and the current keyboard layout is not a LTR one, if |
880 // the input text is pure RTL text, the layout changes to English; if the | 880 // the input text is pure RTL text, the layout changes to English; if the |
881 // input text is bidirectional text, the layout changes to the keyboard | 881 // input text is bidirectional text, the layout changes to the keyboard |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1057 //////////////////////////////////////////////////////////////////////////////// | 1057 //////////////////////////////////////////////////////////////////////////////// |
1058 // NativeTextfieldWrapper, public: | 1058 // NativeTextfieldWrapper, public: |
1059 | 1059 |
1060 // static | 1060 // static |
1061 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( | 1061 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( |
1062 Textfield* field) { | 1062 Textfield* field) { |
1063 return new NativeTextfieldWin(field); | 1063 return new NativeTextfieldWin(field); |
1064 } | 1064 } |
1065 | 1065 |
1066 } // namespace views | 1066 } // namespace views |
OLD | NEW |