| 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/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 "app/keyboard_codes.h" | |
| 14 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 15 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 16 #include "gfx/insets.h" | 15 #include "gfx/insets.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 "app/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" | 24 #include "app/win/win_util.h" |
| 25 #include "base/win/win_util.h" | 25 #include "base/win/win_util.h" |
| 26 // TODO(beng): this should be removed when the OS_WIN hack from | 26 // TODO(beng): this should be removed when the OS_WIN hack from |
| 27 // ViewHierarchyChanged is removed. | 27 // ViewHierarchyChanged is removed. |
| 28 #include "views/controls/textfield/native_textfield_win.h" | 28 #include "views/controls/textfield/native_textfield_win.h" |
| 29 #include "views/controls/textfield/native_textfield_views.h" | 29 #include "views/controls/textfield/native_textfield_views.h" |
| 30 #endif | 30 #endif |
| 31 | 31 |
| 32 namespace views { | 32 namespace views { |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 return View::IsFocusable() && !read_only_; | 265 return View::IsFocusable() && !read_only_; |
| 266 } | 266 } |
| 267 | 267 |
| 268 void Textfield::AboutToRequestFocusFromTabTraversal(bool reverse) { | 268 void Textfield::AboutToRequestFocusFromTabTraversal(bool reverse) { |
| 269 SelectAll(); | 269 SelectAll(); |
| 270 } | 270 } |
| 271 | 271 |
| 272 bool Textfield::SkipDefaultKeyEventProcessing(const KeyEvent& e) { | 272 bool Textfield::SkipDefaultKeyEventProcessing(const KeyEvent& e) { |
| 273 // TODO(hamaji): Figure out which keyboard combinations we need to add here, | 273 // TODO(hamaji): Figure out which keyboard combinations we need to add here, |
| 274 // similar to LocationBarView::SkipDefaultKeyEventProcessing. | 274 // similar to LocationBarView::SkipDefaultKeyEventProcessing. |
| 275 app::KeyboardCode key = e.GetKeyCode(); | 275 ui::KeyboardCode key = e.GetKeyCode(); |
| 276 if (key == app::VKEY_BACK) | 276 if (key == ui::VKEY_BACK) |
| 277 return true; // We'll handle BackSpace ourselves. | 277 return true; // We'll handle BackSpace ourselves. |
| 278 | 278 |
| 279 #if defined(OS_WIN) | 279 #if defined(OS_WIN) |
| 280 // We don't translate accelerators for ALT + NumPad digit on Windows, they are | 280 // We don't translate accelerators for ALT + NumPad digit on Windows, they are |
| 281 // used for entering special characters. We do translate alt-home. | 281 // used for entering special characters. We do translate alt-home. |
| 282 if (e.IsAltDown() && (key != app::VKEY_HOME) && | 282 if (e.IsAltDown() && (key != ui::VKEY_HOME) && |
| 283 app::win::IsNumPadDigit(key, e.IsExtendedKey())) | 283 app::win::IsNumPadDigit(key, e.IsExtendedKey())) |
| 284 return true; | 284 return true; |
| 285 #endif | 285 #endif |
| 286 return false; | 286 return false; |
| 287 } | 287 } |
| 288 | 288 |
| 289 void Textfield::PaintFocusBorder(gfx::Canvas* canvas) { | 289 void Textfield::PaintFocusBorder(gfx::Canvas* canvas) { |
| 290 if (NativeViewHost::kRenderNativeControlFocus) | 290 if (NativeViewHost::kRenderNativeControlFocus) |
| 291 View::PaintFocusBorder(canvas); | 291 View::PaintFocusBorder(canvas); |
| 292 } | 292 } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 } | 373 } |
| 374 #endif | 374 #endif |
| 375 } | 375 } |
| 376 } | 376 } |
| 377 | 377 |
| 378 std::string Textfield::GetClassName() const { | 378 std::string Textfield::GetClassName() const { |
| 379 return kViewClassName; | 379 return kViewClassName; |
| 380 } | 380 } |
| 381 | 381 |
| 382 } // namespace views | 382 } // namespace views |
| OLD | NEW |