OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/textfield.h" | 5 #include "views/controls/textfield/textfield.h" |
6 | 6 |
7 #if defined(OS_LINUX) | 7 #if defined(OS_LINUX) |
8 #include <gdk/gdkkeysyms.h> | 8 #include <gdk/gdkkeysyms.h> |
9 #endif | 9 #endif |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
15 #include "gfx/insets.h" | 15 #include "gfx/insets.h" |
16 #include "ui/base/keycodes/keyboard_codes.h" | 16 #include "ui/base/keycodes/keyboard_codes.h" |
17 #include "views/controls/native/native_view_host.h" | 17 #include "views/controls/native/native_view_host.h" |
18 #include "views/controls/textfield/native_textfield_wrapper.h" | 18 #include "views/controls/textfield/native_textfield_wrapper.h" |
19 #include "views/widget/widget.h" | 19 #include "views/widget/widget.h" |
20 | 20 |
21 #if defined(OS_LINUX) | 21 #if defined(OS_LINUX) |
22 #include "ui/base/keycodes/keyboard_code_conversion_gtk.h" | 22 #include "ui/base/keycodes/keyboard_code_conversion_gtk.h" |
23 #elif defined(OS_WIN) | 23 #elif defined(OS_WIN) |
24 #include "app/win/win_util.h" | |
25 #include "base/win/win_util.h" | 24 #include "base/win/win_util.h" |
26 // TODO(beng): this should be removed when the OS_WIN hack from | 25 // TODO(beng): this should be removed when the OS_WIN hack from |
27 // ViewHierarchyChanged is removed. | 26 // ViewHierarchyChanged is removed. |
28 #include "views/controls/textfield/native_textfield_win.h" | 27 #include "views/controls/textfield/native_textfield_win.h" |
29 #include "views/controls/textfield/native_textfield_views.h" | 28 #include "views/controls/textfield/native_textfield_views.h" |
30 #endif | 29 #endif |
31 | 30 |
32 namespace views { | 31 namespace views { |
33 | 32 |
34 // static | 33 // static |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 // TODO(hamaji): Figure out which keyboard combinations we need to add here, | 310 // TODO(hamaji): Figure out which keyboard combinations we need to add here, |
312 // similar to LocationBarView::SkipDefaultKeyEventProcessing. | 311 // similar to LocationBarView::SkipDefaultKeyEventProcessing. |
313 ui::KeyboardCode key = e.GetKeyCode(); | 312 ui::KeyboardCode key = e.GetKeyCode(); |
314 if (key == ui::VKEY_BACK) | 313 if (key == ui::VKEY_BACK) |
315 return true; // We'll handle BackSpace ourselves. | 314 return true; // We'll handle BackSpace ourselves. |
316 | 315 |
317 #if defined(OS_WIN) | 316 #if defined(OS_WIN) |
318 // We don't translate accelerators for ALT + NumPad digit on Windows, they are | 317 // We don't translate accelerators for ALT + NumPad digit on Windows, they are |
319 // used for entering special characters. We do translate alt-home. | 318 // used for entering special characters. We do translate alt-home. |
320 if (e.IsAltDown() && (key != ui::VKEY_HOME) && | 319 if (e.IsAltDown() && (key != ui::VKEY_HOME) && |
321 app::win::IsNumPadDigit(key, e.IsExtendedKey())) | 320 NativeTextfieldWin::IsNumPadDigit(key, e.IsExtendedKey())) |
322 return true; | 321 return true; |
323 #endif | 322 #endif |
324 return false; | 323 return false; |
325 } | 324 } |
326 | 325 |
327 void Textfield::PaintFocusBorder(gfx::Canvas* canvas) { | 326 void Textfield::PaintFocusBorder(gfx::Canvas* canvas) { |
328 if (NativeViewHost::kRenderNativeControlFocus) | 327 if (NativeViewHost::kRenderNativeControlFocus) |
329 View::PaintFocusBorder(canvas); | 328 View::PaintFocusBorder(canvas); |
330 } | 329 } |
331 | 330 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 } | 410 } |
412 #endif | 411 #endif |
413 } | 412 } |
414 } | 413 } |
415 | 414 |
416 std::string Textfield::GetClassName() const { | 415 std::string Textfield::GetClassName() const { |
417 return kViewClassName; | 416 return kViewClassName; |
418 } | 417 } |
419 | 418 |
420 } // namespace views | 419 } // namespace views |
OLD | NEW |