| 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 "ui/base/keycodes/keyboard_codes.h" | 15 #include "ui/base/keycodes/keyboard_codes.h" |
| 16 #include "ui/gfx/insets.h" | 16 #include "ui/gfx/insets.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 "base/win/win_util.h" | 24 #include "base/win/win_util.h" |
| 25 // 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 |
| 26 // ViewHierarchyChanged is removed. | 26 // ViewHierarchyChanged is removed. |
| 27 #include "views/controls/textfield/native_textfield_win.h" | 27 #include "views/controls/textfield/native_textfield_win.h" |
| 28 #include "views/controls/textfield/native_textfield_views.h" | 28 #include "views/controls/textfield/native_textfield_views.h" |
| 29 #include "views/events/event_utils_win.h" |
| 29 #endif | 30 #endif |
| 30 | 31 |
| 31 namespace views { | 32 namespace views { |
| 32 | 33 |
| 33 // static | 34 // static |
| 34 const char Textfield::kViewClassName[] = "views/Textfield"; | 35 const char Textfield::kViewClassName[] = "views/Textfield"; |
| 35 | 36 |
| 36 ///////////////////////////////////////////////////////////////////////////// | 37 ///////////////////////////////////////////////////////////////////////////// |
| 37 // TextRange | 38 // TextRange |
| 38 | 39 |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 // TODO(hamaji): Figure out which keyboard combinations we need to add here, | 311 // TODO(hamaji): Figure out which keyboard combinations we need to add here, |
| 311 // similar to LocationBarView::SkipDefaultKeyEventProcessing. | 312 // similar to LocationBarView::SkipDefaultKeyEventProcessing. |
| 312 ui::KeyboardCode key = e.key_code(); | 313 ui::KeyboardCode key = e.key_code(); |
| 313 if (key == ui::VKEY_BACK) | 314 if (key == ui::VKEY_BACK) |
| 314 return true; // We'll handle BackSpace ourselves. | 315 return true; // We'll handle BackSpace ourselves. |
| 315 | 316 |
| 316 #if defined(OS_WIN) | 317 #if defined(OS_WIN) |
| 317 // We don't translate accelerators for ALT + NumPad digit on Windows, they are | 318 // We don't translate accelerators for ALT + NumPad digit on Windows, they are |
| 318 // used for entering special characters. We do translate alt-home. | 319 // used for entering special characters. We do translate alt-home. |
| 319 if (e.IsAltDown() && (key != ui::VKEY_HOME) && | 320 if (e.IsAltDown() && (key != ui::VKEY_HOME) && |
| 320 NativeTextfieldWin::IsNumPadDigit(key, e.IsExtendedKey())) | 321 NativeTextfieldWin::IsNumPadDigit(key, IsExtendedKey(e))) |
| 321 return true; | 322 return true; |
| 322 #endif | 323 #endif |
| 323 return false; | 324 return false; |
| 324 } | 325 } |
| 325 | 326 |
| 326 void Textfield::PaintFocusBorder(gfx::Canvas* canvas) { | 327 void Textfield::PaintFocusBorder(gfx::Canvas* canvas) { |
| 327 if (NativeViewHost::kRenderNativeControlFocus) | 328 if (NativeViewHost::kRenderNativeControlFocus) |
| 328 View::PaintFocusBorder(canvas); | 329 View::PaintFocusBorder(canvas); |
| 329 } | 330 } |
| 330 | 331 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 } | 411 } |
| 411 #endif | 412 #endif |
| 412 } | 413 } |
| 413 } | 414 } |
| 414 | 415 |
| 415 std::string Textfield::GetClassName() const { | 416 std::string Textfield::GetClassName() const { |
| 416 return kViewClassName; | 417 return kViewClassName; |
| 417 } | 418 } |
| 418 | 419 |
| 419 } // namespace views | 420 } // namespace views |
| OLD | NEW |