Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(982)

Side by Side Diff: views/controls/textfield/textfield.cc

Issue 7942004: Consolidate/cleanup event cracking code; single out GdkEvents. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Windows event code consolidation. Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/accessibility/accessible_view_state.h" 15 #include "ui/base/accessibility/accessible_view_state.h"
16 #include "ui/base/ime/text_input_type.h" 16 #include "ui/base/ime/text_input_type.h"
17 #include "ui/base/keycodes/keyboard_codes.h" 17 #include "ui/base/keycodes/keyboard_codes.h"
18 #include "ui/base/range/range.h" 18 #include "ui/base/range/range.h"
19 #include "ui/gfx/insets.h" 19 #include "ui/gfx/insets.h"
20 #include "views/controls/native/native_view_host.h" 20 #include "views/controls/native/native_view_host.h"
21 #include "views/controls/textfield/native_textfield_wrapper.h" 21 #include "views/controls/textfield/native_textfield_wrapper.h"
22 #include "views/controls/textfield/textfield_controller.h" 22 #include "views/controls/textfield/textfield_controller.h"
23 #include "views/widget/widget.h" 23 #include "views/widget/widget.h"
24 24
25 #if defined(OS_LINUX) 25 #if defined(OS_LINUX)
26 #include "ui/base/keycodes/keyboard_code_conversion_gtk.h" 26 #include "ui/base/keycodes/keyboard_code_conversion_gtk.h"
27 #elif defined(OS_WIN) 27 #elif defined(OS_WIN)
28 #include "base/win/win_util.h" 28 #include "base/win/win_util.h"
29 #include "ui/base/win/event_util.h"
29 // TODO(beng): this should be removed when the OS_WIN hack from 30 // TODO(beng): this should be removed when the OS_WIN hack from
30 // ViewHierarchyChanged is removed. 31 // ViewHierarchyChanged is removed.
31 #include "views/controls/textfield/native_textfield_views.h" 32 #include "views/controls/textfield/native_textfield_views.h"
32 #include "views/controls/textfield/native_textfield_win.h" 33 #include "views/controls/textfield/native_textfield_win.h"
33 #include "views/events/event_utils_win.h"
34 #endif 34 #endif
35 35
36 namespace views { 36 namespace views {
37 37
38 // static 38 // static
39 const char Textfield::kViewClassName[] = "views/Textfield"; 39 const char Textfield::kViewClassName[] = "views/Textfield";
40 40
41 ///////////////////////////////////////////////////////////////////////////// 41 /////////////////////////////////////////////////////////////////////////////
42 // Textfield 42 // Textfield
43 43
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 ui::KeyboardCode key = e.key_code(); 334 ui::KeyboardCode key = e.key_code();
335 if (key == ui::VKEY_BACK) 335 if (key == ui::VKEY_BACK)
336 return true; // We'll handle BackSpace ourselves. 336 return true; // We'll handle BackSpace ourselves.
337 337
338 #if defined(USE_AURA) 338 #if defined(USE_AURA)
339 NOTIMPLEMENTED(); 339 NOTIMPLEMENTED();
340 #elif defined(OS_WIN) 340 #elif defined(OS_WIN)
341 // We don't translate accelerators for ALT + NumPad digit on Windows, they are 341 // We don't translate accelerators for ALT + NumPad digit on Windows, they are
342 // used for entering special characters. We do translate alt-home. 342 // used for entering special characters. We do translate alt-home.
343 if (e.IsAltDown() && (key != ui::VKEY_HOME) && 343 if (e.IsAltDown() && (key != ui::VKEY_HOME) &&
344 NativeTextfieldWin::IsNumPadDigit(key, IsExtendedKey(e))) 344 NativeTextfieldWin::IsNumPadDigit(key,
345 ui::IsExtendedKey(e.native_event())))
345 return true; 346 return true;
346 #endif 347 #endif
347 return false; 348 return false;
348 } 349 }
349 350
350 void Textfield::OnPaintBackground(gfx::Canvas* canvas) { 351 void Textfield::OnPaintBackground(gfx::Canvas* canvas) {
351 // Overridden to be public - gtk_views_entry.cc wants to call it. 352 // Overridden to be public - gtk_views_entry.cc wants to call it.
352 View::OnPaintBackground(canvas); 353 View::OnPaintBackground(canvas);
353 } 354 }
354 355
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 } 434 }
434 #endif 435 #endif
435 } 436 }
436 } 437 }
437 438
438 std::string Textfield::GetClassName() const { 439 std::string Textfield::GetClassName() const {
439 return kViewClassName; 440 return kViewClassName;
440 } 441 }
441 442
442 } // namespace views 443 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698