| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "app/gfx/insets.h" | 11 #include "app/gfx/insets.h" |
| 12 #if defined(OS_WIN) | 12 #if defined(OS_WIN) |
| 13 #include "app/win_util.h" | 13 #include "app/win_util.h" |
| 14 #include "base/win_util.h" |
| 14 #endif | 15 #endif |
| 15 | 16 |
| 16 #include "base/string_util.h" | 17 #include "base/string_util.h" |
| 17 #include "views/controls/textfield/native_textfield_wrapper.h" | 18 #include "views/controls/textfield/native_textfield_wrapper.h" |
| 18 #include "views/widget/widget.h" | 19 #include "views/widget/widget.h" |
| 19 | 20 |
| 20 #if defined(OS_WIN) | 21 #if defined(OS_WIN) |
| 21 // TODO(beng): this should be removed when the OS_WIN hack from | 22 // TODO(beng): this should be removed when the OS_WIN hack from |
| 22 // ViewHierarchyChanged is removed. | 23 // ViewHierarchyChanged is removed. |
| 23 #include "views/controls/textfield/native_textfield_win.h" | 24 #include "views/controls/textfield/native_textfield_win.h" |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 base::KeyboardCode Textfield::Keystroke::GetKeyboardCode() const { | 283 base::KeyboardCode Textfield::Keystroke::GetKeyboardCode() const { |
| 283 #if defined(OS_WIN) | 284 #if defined(OS_WIN) |
| 284 return static_cast<base::KeyboardCode>(key_); | 285 return static_cast<base::KeyboardCode>(key_); |
| 285 #else | 286 #else |
| 286 return static_cast<base::KeyboardCode>(event_.keyval); | 287 return static_cast<base::KeyboardCode>(event_.keyval); |
| 287 #endif | 288 #endif |
| 288 } | 289 } |
| 289 | 290 |
| 290 #if defined(OS_WIN) | 291 #if defined(OS_WIN) |
| 291 bool Textfield::Keystroke::IsControlHeld() const { | 292 bool Textfield::Keystroke::IsControlHeld() const { |
| 292 return GetKeyState(VK_CONTROL) >= 0; | 293 return win_util::IsCtrlPressed(); |
| 293 } | 294 } |
| 294 | 295 |
| 295 bool Textfield::Keystroke::IsShiftHeld() const { | 296 bool Textfield::Keystroke::IsShiftHeld() const { |
| 296 return GetKeyState(VK_SHIFT) >= 0; | 297 return win_util::IsShiftPressed(); |
| 297 } | 298 } |
| 298 #else | 299 #else |
| 299 bool Textfield::Keystroke::IsControlHeld() const { | 300 bool Textfield::Keystroke::IsControlHeld() const { |
| 300 return (event_.state & gtk_accelerator_get_default_mod_mask()) == | 301 return (event_.state & gtk_accelerator_get_default_mod_mask()) == |
| 301 GDK_CONTROL_MASK; | 302 GDK_CONTROL_MASK; |
| 302 } | 303 } |
| 303 | 304 |
| 304 bool Textfield::Keystroke::IsShiftHeld() const { | 305 bool Textfield::Keystroke::IsShiftHeld() const { |
| 305 return (event_.state & gtk_accelerator_get_default_mod_mask()) == | 306 return (event_.state & gtk_accelerator_get_default_mod_mask()) == |
| 306 GDK_SHIFT_MASK; | 307 GDK_SHIFT_MASK; |
| 307 } | 308 } |
| 308 #endif | 309 #endif |
| 309 | 310 |
| 310 } // namespace views | 311 } // namespace views |
| OLD | NEW |