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/browser/android/content_view_core_impl.h" | 5 #include "content/browser/android/content_view_core_impl.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 #include "webkit/glue/webmenuitem.h" | 43 #include "webkit/glue/webmenuitem.h" |
44 #include "webkit/user_agent/user_agent_util.h" | 44 #include "webkit/user_agent/user_agent_util.h" |
45 | 45 |
46 using base::android::AttachCurrentThread; | 46 using base::android::AttachCurrentThread; |
47 using base::android::ConvertJavaStringToUTF16; | 47 using base::android::ConvertJavaStringToUTF16; |
48 using base::android::ConvertJavaStringToUTF8; | 48 using base::android::ConvertJavaStringToUTF8; |
49 using base::android::ConvertUTF16ToJavaString; | 49 using base::android::ConvertUTF16ToJavaString; |
50 using base::android::ConvertUTF8ToJavaString; | 50 using base::android::ConvertUTF8ToJavaString; |
51 using base::android::GetClass; | 51 using base::android::GetClass; |
52 using base::android::HasField; | 52 using base::android::HasField; |
| 53 using base::android::MethodID; |
53 using base::android::JavaByteArrayToByteVector; | 54 using base::android::JavaByteArrayToByteVector; |
54 using base::android::ScopedJavaGlobalRef; | 55 using base::android::ScopedJavaGlobalRef; |
55 using base::android::ScopedJavaLocalRef; | 56 using base::android::ScopedJavaLocalRef; |
56 using WebKit::WebGestureEvent; | 57 using WebKit::WebGestureEvent; |
57 using WebKit::WebInputEvent; | 58 using WebKit::WebInputEvent; |
58 using WebKit::WebInputEventFactory; | 59 using WebKit::WebInputEventFactory; |
59 | 60 |
60 // Describes the type and enabled state of a select popup item. | 61 // Describes the type and enabled state of a select popup item. |
61 // Keep in sync with the value defined in SelectPopupDialog.java | 62 // Keep in sync with the value defined in SelectPopupDialog.java |
62 enum PopupItemType { | 63 enum PopupItemType { |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 static_cast<jint>(result_pair->first), j_json.obj()); | 222 static_cast<jint>(result_pair->first), j_json.obj()); |
222 } | 223 } |
223 break; | 224 break; |
224 } | 225 } |
225 } | 226 } |
226 } | 227 } |
227 | 228 |
228 void ContentViewCoreImpl::InitJNI(JNIEnv* env, jobject obj) { | 229 void ContentViewCoreImpl::InitJNI(JNIEnv* env, jobject obj) { |
229 java_object_ = new JavaObject; | 230 java_object_ = new JavaObject; |
230 java_object_->rect_clazz.Reset(GetClass(env, "android/graphics/Rect")); | 231 java_object_->rect_clazz.Reset(GetClass(env, "android/graphics/Rect")); |
231 java_object_->rect_constructor = | 232 java_object_->rect_constructor = MethodID::Get<MethodID::TYPE_INSTANCE>( |
232 GetMethodID(env, java_object_->rect_clazz, "<init>", "(IIII)V"); | 233 env, java_object_->rect_clazz.obj(), "<init>", "(IIII)V"); |
233 } | 234 } |
234 | 235 |
235 RenderWidgetHostViewAndroid* | 236 RenderWidgetHostViewAndroid* |
236 ContentViewCoreImpl::GetRenderWidgetHostViewAndroid() { | 237 ContentViewCoreImpl::GetRenderWidgetHostViewAndroid() { |
237 RenderWidgetHostView* rwhv = NULL; | 238 RenderWidgetHostView* rwhv = NULL; |
238 if (web_contents_) | 239 if (web_contents_) |
239 rwhv = web_contents_->GetRenderWidgetHostView(); | 240 rwhv = web_contents_->GetRenderWidgetHostView(); |
240 return static_cast<RenderWidgetHostViewAndroid*>(rwhv); | 241 return static_cast<RenderWidgetHostViewAndroid*>(rwhv); |
241 } | 242 } |
242 | 243 |
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { | 1029 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { |
1029 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; | 1030 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; |
1030 return false; | 1031 return false; |
1031 } | 1032 } |
1032 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); | 1033 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); |
1033 | 1034 |
1034 return RegisterNativesImpl(env) >= 0; | 1035 return RegisterNativesImpl(env) >= 0; |
1035 } | 1036 } |
1036 | 1037 |
1037 } // namespace content | 1038 } // namespace content |
OLD | NEW |