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/web_contents_observer_android.h" | 5 #include "content/browser/android/web_contents_observer_android.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include <jni.h> | 9 #include <jni.h> |
10 | 10 |
11 #include "base/android/jni_android.h" | 11 #include "base/android/jni_android.h" |
12 #include "base/android/jni_string.h" | 12 #include "base/android/jni_string.h" |
13 #include "base/android/scoped_java_ref.h" | 13 #include "base/android/scoped_java_ref.h" |
14 #include "content/browser/android/content_view_core_impl.h" | 14 #include "content/browser/android/content_view_core_impl.h" |
15 #include "content/browser/renderer_host/render_widget_host_impl.h" | 15 #include "content/browser/renderer_host/render_widget_host_impl.h" |
16 #include "content/browser/web_contents/web_contents_impl.h" | 16 #include "content/browser/web_contents/web_contents_impl.h" |
17 #include "content/public/browser/navigation_details.h" | 17 #include "content/public/browser/navigation_details.h" |
18 #include "content/public/browser/navigation_entry.h" | 18 #include "content/public/browser/navigation_entry.h" |
19 #include "jni/WebContentsObserverAndroid_jni.h" | 19 #include "jni/WebContentsObserverAndroid_jni.h" |
20 | 20 |
21 using base::android::AttachCurrentThread; | 21 using base::android::AttachCurrentThread; |
22 using base::android::ScopedJavaLocalRef; | 22 using base::android::ScopedJavaLocalRef; |
23 using base::android::ConvertUTF8ToJavaString; | 23 using base::android::ConvertUTF8ToJavaString; |
24 using base::android::ConvertUTF16ToJavaString; | 24 using base::android::ConvertUTF16ToJavaString; |
25 using base::android::HasClass; | |
26 | 25 |
27 namespace content { | 26 namespace content { |
28 | 27 |
29 WebContentsObserverAndroid::WebContentsObserverAndroid( | 28 WebContentsObserverAndroid::WebContentsObserverAndroid( |
30 JNIEnv* env, | 29 JNIEnv* env, |
31 jobject obj, | 30 jobject obj, |
32 WebContents* web_contents) | 31 WebContents* web_contents) |
33 : WebContentsObserver(web_contents), | 32 : WebContentsObserver(web_contents), |
34 weak_java_observer_(env, obj){ | 33 weak_java_observer_(env, obj){ |
35 } | 34 } |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 | 244 |
246 Java_WebContentsObserverAndroid_didFailLoad( | 245 Java_WebContentsObserverAndroid_didFailLoad( |
247 env, obj.obj(), | 246 env, obj.obj(), |
248 is_provisional_load, | 247 is_provisional_load, |
249 is_main_frame, | 248 is_main_frame, |
250 error_code, | 249 error_code, |
251 jstring_error_description.obj(), jstring_url.obj()); | 250 jstring_error_description.obj(), jstring_url.obj()); |
252 } | 251 } |
253 | 252 |
254 bool RegisterWebContentsObserverAndroid(JNIEnv* env) { | 253 bool RegisterWebContentsObserverAndroid(JNIEnv* env) { |
255 if (!HasClass(env, kWebContentsObserverAndroidClassPath)) { | |
256 DLOG(ERROR) << "Unable to find class WebContentsObserverAndroid!"; | |
257 return false; | |
258 } | |
259 return RegisterNativesImpl(env); | 254 return RegisterNativesImpl(env); |
260 } | 255 } |
261 } // namespace content | 256 } // namespace content |
OLD | NEW |