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

Side by Side Diff: chrome/common/native_web_keyboard_event_views.cc

Issue 8598024: Now that we are doing a hard-cut-over to Aura, remove a bunch of *Views based classes that are ob... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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
« no previous file with comments | « chrome/common/native_web_keyboard_event_views.h ('k') | ui/aura_shell/aura_shell.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/common/native_web_keyboard_event_views.h"
6
7 #if defined(TOOLKIT_USES_GTK)
8 #include <gdk/gdk.h>
9 #endif
10
11 #include "base/logging.h"
12 #include "ui/views/events/event.h"
13
14 namespace {
15
16 int ViewsFlagsToWebInputEventModifiers(int flags) {
17 return
18 (flags & ui::EF_SHIFT_DOWN ? WebKit::WebInputEvent::ShiftKey : 0) |
19 (flags & ui::EF_CONTROL_DOWN ? WebKit::WebInputEvent::ControlKey : 0) |
20 (flags & ui::EF_CAPS_LOCK_DOWN ? WebKit::WebInputEvent::CapsLockOn : 0) |
21 (flags & ui::EF_ALT_DOWN ? WebKit::WebInputEvent::AltKey : 0);
22 }
23
24 } // namespace
25
26 NativeWebKeyboardEventViews::NativeWebKeyboardEventViews(
27 const views::KeyEvent& event) {
28 skip_in_browser = false;
29 DCHECK(event.type() == ui::ET_KEY_PRESSED ||
30 event.type() == ui::ET_KEY_RELEASED);
31
32 if (event.type() == ui::ET_KEY_PRESSED)
33 type = WebKit::WebInputEvent::RawKeyDown;
34 else
35 type = WebKit::WebInputEvent::KeyUp;
36
37 modifiers = ViewsFlagsToWebInputEventModifiers(event.flags());
38 timeStampSeconds = event.time_stamp().ToDoubleT();
39 windowsKeyCode = event.key_code();
40 nativeKeyCode = windowsKeyCode;
41 text[0] = event.GetCharacter();
42 unmodifiedText[0] = event.GetUnmodifiedCharacter();
43 setKeyIdentifierFromWindowsKeyCode();
44
45 #if defined(USE_AURA)
46 // TODO(beng):
47 NOTIMPLEMENTED();
48 #elif defined(OS_WIN)
49 // |os_event| is a MSG struct, so we can copy it directly.
50 os_event = event.native_event();
51 #elif defined(TOOLKIT_USES_GTK)
52 if (event.gdk_event()) {
53 os_event = gdk_event_copy(event.gdk_event());
54 nativeKeyCode = os_event->key.keyval;
55 } else {
56 os_event = NULL;
57 }
58 #endif
59
60 #if defined(TOOLKIT_USES_GTK)
61 match_edit_command = false;
62 #endif
63 }
64
65 NativeWebKeyboardEventViews::NativeWebKeyboardEventViews(
66 uint16 character,
67 int flags,
68 double time_stamp_seconds,
69 FromViewsEvent) {
70 skip_in_browser = true;
71
72 type = WebKit::WebInputEvent::Char;
73 modifiers = ViewsFlagsToWebInputEventModifiers(flags);
74 timeStampSeconds = time_stamp_seconds;
75 windowsKeyCode = character;
76 nativeKeyCode = character;
77 text[0] = character;
78 unmodifiedText[0] = character;
79 isSystemKey = (flags & ui::EF_ALT_DOWN) != 0;
80
81 #if defined(OS_WIN)
82 memset(&os_event, 0, sizeof(os_event));
83 #elif defined(TOOLKIT_USES_GTK)
84 os_event = NULL;
85 #endif
86
87 #if defined(TOOLKIT_USES_GTK)
88 match_edit_command = false;
89 #endif
90 }
91
92 NativeWebKeyboardEventViews::~NativeWebKeyboardEventViews() {
93 }
OLDNEW
« no previous file with comments | « chrome/common/native_web_keyboard_event_views.h ('k') | ui/aura_shell/aura_shell.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698