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

Side by Side Diff: content/common/native_web_keyboard_event.h

Issue 7766012: Move native_web_keyboard_event_views.cc to chrome, so that we don't have any views code in conten... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Get rid of the views constructor in content as well 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 #ifndef CONTENT_COMMON_NATIVE_WEB_KEYBOARD_EVENT_H_ 5 #ifndef CONTENT_COMMON_NATIVE_WEB_KEYBOARD_EVENT_H_
6 #define CONTENT_COMMON_NATIVE_WEB_KEYBOARD_EVENT_H_ 6 #define CONTENT_COMMON_NATIVE_WEB_KEYBOARD_EVENT_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
12 12
13 #if defined(OS_WIN) 13 #if defined(OS_WIN)
14 #include <windows.h> 14 #include <windows.h>
15 #elif defined(OS_MACOSX) 15 #elif defined(OS_MACOSX)
16 #ifdef __OBJC__ 16 #ifdef __OBJC__
17 @class NSEvent; 17 @class NSEvent;
18 #else 18 #else
19 class NSEvent; 19 class NSEvent;
20 #endif // __OBJC__ 20 #endif // __OBJC__
21 #elif defined(OS_POSIX) 21 #elif defined(OS_POSIX)
22 typedef struct _GdkEventKey GdkEventKey; 22 typedef struct _GdkEventKey GdkEventKey;
23 #endif 23 #endif
24 24
25 #if defined(TOOLKIT_VIEWS)
26 namespace views {
27 class KeyEvent;
28 }
29 #endif
30
31 // Owns a platform specific event; used to pass own and pass event through 25 // Owns a platform specific event; used to pass own and pass event through
32 // platform independent code. 26 // platform independent code.
33 struct NativeWebKeyboardEvent : public WebKit::WebKeyboardEvent { 27 struct NativeWebKeyboardEvent : public WebKit::WebKeyboardEvent {
34 NativeWebKeyboardEvent(); 28 NativeWebKeyboardEvent();
35 29
36 #if defined(OS_WIN) 30 #if defined(OS_WIN)
37 NativeWebKeyboardEvent(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); 31 NativeWebKeyboardEvent(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
38 #elif defined(OS_MACOSX) 32 #elif defined(OS_MACOSX)
39 explicit NativeWebKeyboardEvent(NSEvent *event); 33 explicit NativeWebKeyboardEvent(NSEvent *event);
40 NativeWebKeyboardEvent(wchar_t character, 34 NativeWebKeyboardEvent(wchar_t character,
41 int state, 35 int state,
42 double time_stamp_seconds); 36 double time_stamp_seconds);
43 #elif defined(TOOLKIT_USES_GTK) 37 #elif defined(TOOLKIT_USES_GTK)
44 // TODO(suzhe): Limit these constructors to Linux native Gtk port. 38 // TODO(suzhe): Limit these constructors to Linux native Gtk port.
45 // For Linux Views port, after using RenderWidgetHostViewViews to replace 39 // For Linux Views port, after using RenderWidgetHostViewViews to replace
46 // RenderWidgetHostViewGtk, we can use constructors for TOOLKIT_VIEWS defined 40 // RenderWidgetHostViewGtk, we can use constructors for TOOLKIT_VIEWS defined
47 // below. 41 // below.
48 explicit NativeWebKeyboardEvent(const GdkEventKey* event); 42 explicit NativeWebKeyboardEvent(const GdkEventKey* event);
49 NativeWebKeyboardEvent(wchar_t character, 43 NativeWebKeyboardEvent(wchar_t character,
50 int state, 44 int state,
51 double time_stamp_seconds); 45 double time_stamp_seconds);
52 #endif 46 #endif
53 47
54 #if defined(TOOLKIT_VIEWS)
55 // TODO(suzhe): remove once we get rid of Gtk from Views.
56 struct FromViewsEvent {};
57 // These two constructors are shared between Windows and Linux Views ports.
58 explicit NativeWebKeyboardEvent(const views::KeyEvent& event);
59 // TODO(suzhe): Sadly, we need to add a meanless FromViewsEvent parameter to
60 // distinguish between this contructor and above Gtk one, because they use
61 // different modifier flags. We can remove this extra parameter as soon as we
62 // disable above Gtk constructor in Linux Views port.
63 NativeWebKeyboardEvent(uint16 character,
64 int flags,
65 double time_stamp_seconds,
66 FromViewsEvent);
67 #endif
68
69 NativeWebKeyboardEvent(const NativeWebKeyboardEvent& event); 48 NativeWebKeyboardEvent(const NativeWebKeyboardEvent& event);
70 ~NativeWebKeyboardEvent(); 49 ~NativeWebKeyboardEvent();
71 50
72 NativeWebKeyboardEvent& operator=(const NativeWebKeyboardEvent& event); 51 NativeWebKeyboardEvent& operator=(const NativeWebKeyboardEvent& event);
73 52
74 #if defined(OS_WIN) 53 #if defined(OS_WIN)
75 MSG os_event; 54 MSG os_event;
76 #elif defined(OS_MACOSX) 55 #elif defined(OS_MACOSX)
77 NSEvent* os_event; 56 NSEvent* os_event;
78 #elif defined(TOOLKIT_USES_GTK) 57 #elif defined(TOOLKIT_USES_GTK)
79 GdkEventKey* os_event; 58 GdkEventKey* os_event;
80 #endif 59 #endif
81 60
82 // True if the browser should ignore this event if it's not handled by the 61 // True if the browser should ignore this event if it's not handled by the
83 // renderer. This happens for RawKeyDown events that are created while IME is 62 // renderer. This happens for RawKeyDown events that are created while IME is
84 // active and is necessary to prevent backspace from doing "history back" if 63 // active and is necessary to prevent backspace from doing "history back" if
85 // it is hit in ime mode. 64 // it is hit in ime mode.
86 // Currently, it's only used by Linux and Mac ports. 65 // Currently, it's only used by Linux and Mac ports.
87 bool skip_in_browser; 66 bool skip_in_browser;
88 67
89 #if defined(TOOLKIT_USES_GTK) 68 #if defined(TOOLKIT_USES_GTK)
90 // True if the key event matches an edit command. In order to ensure the edit 69 // True if the key event matches an edit command. In order to ensure the edit
91 // command always work in web page, the browser should not pre-handle this key 70 // command always work in web page, the browser should not pre-handle this key
92 // event as a reserved accelerator. See http://crbug.com/54573 71 // event as a reserved accelerator. See http://crbug.com/54573
93 bool match_edit_command; 72 bool match_edit_command;
94 #endif 73 #endif
95 }; 74 };
96 75
97 #endif // CONTENT_COMMON_NATIVE_WEB_KEYBOARD_EVENT_H_ 76 #endif // CONTENT_COMMON_NATIVE_WEB_KEYBOARD_EVENT_H_
OLDNEW
« no previous file with comments | « chrome/common/native_web_keyboard_event_views.cc ('k') | content/common/native_web_keyboard_event_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698