OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/public/browser/native_web_keyboard_event.h" | 5 #include "content/public/browser/native_web_keyboard_event.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "third_party/WebKit/Source/WebKit/chromium/public/android/WebInputEvent
Factory.h" | 8 #include "third_party/WebKit/Source/WebKit/chromium/public/android/WebInputEvent
Factory.h" |
9 #include "ui/gfx/native_widget_types.h" | 9 #include "ui/gfx/native_widget_types.h" |
10 | 10 |
11 using WebKit::WebInputEventFactory; | 11 using WebKit::WebInputEventFactory; |
12 | 12 |
13 namespace { | 13 namespace { |
14 | 14 |
15 jobject NewGlobalRefForKeyEvent(jobject key_event) { | 15 jobject NewGlobalRefForKeyEvent(jobject key_event) { |
16 if (key_event == NULL) return NULL; | 16 if (key_event == NULL) return NULL; |
17 return base::android::AttachCurrentThread()->NewGlobalRef(key_event); | 17 return base::android::AttachCurrentThread()->NewGlobalRef(key_event); |
18 } | 18 } |
19 | 19 |
20 void DeleteGlobalRefForKeyEvent(jobject key_event) { | 20 void DeleteGlobalRefForKeyEvent(jobject key_event) { |
21 if (key_event != NULL) | 21 if (key_event != NULL) |
22 base::android::AttachCurrentThread()->DeleteGlobalRef(key_event); | 22 base::android::AttachCurrentThread()->DeleteGlobalRef(key_event); |
23 } | 23 } |
24 | 24 |
25 } | 25 } |
26 | 26 |
| 27 namespace content { |
| 28 |
27 NativeWebKeyboardEvent::NativeWebKeyboardEvent() | 29 NativeWebKeyboardEvent::NativeWebKeyboardEvent() |
28 : os_event(NULL), | 30 : os_event(NULL), |
29 skip_in_browser(false) { | 31 skip_in_browser(false) { |
30 } | 32 } |
31 | 33 |
32 NativeWebKeyboardEvent::NativeWebKeyboardEvent( | 34 NativeWebKeyboardEvent::NativeWebKeyboardEvent( |
33 WebKit::WebInputEvent::Type type, | 35 WebKit::WebInputEvent::Type type, |
34 int modifiers, double time_secs, int keycode, int unicode_character, | 36 int modifiers, double time_secs, int keycode, int unicode_character, |
35 bool is_system_key) | 37 bool is_system_key) |
36 : WebKeyboardEvent(WebInputEventFactory::keyboardEvent( | 38 : WebKeyboardEvent(WebInputEventFactory::keyboardEvent( |
(...skipping 27 matching lines...) Expand all Loading... |
64 | 66 |
65 os_event = NewGlobalRefForKeyEvent(other.os_event); | 67 os_event = NewGlobalRefForKeyEvent(other.os_event); |
66 skip_in_browser = other.skip_in_browser; | 68 skip_in_browser = other.skip_in_browser; |
67 | 69 |
68 return *this; | 70 return *this; |
69 } | 71 } |
70 | 72 |
71 NativeWebKeyboardEvent::~NativeWebKeyboardEvent() { | 73 NativeWebKeyboardEvent::~NativeWebKeyboardEvent() { |
72 DeleteGlobalRefForKeyEvent(os_event); | 74 DeleteGlobalRefForKeyEvent(os_event); |
73 } | 75 } |
| 76 |
| 77 } // namespace content |
OLD | NEW |