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 |
(...skipping 18 matching lines...) Expand all Loading... |
29 JNIEnv* env, | 29 JNIEnv* env, |
30 jobject obj, | 30 jobject obj, |
31 WebContents* web_contents) | 31 WebContents* web_contents) |
32 : WebContentsObserver(web_contents), | 32 : WebContentsObserver(web_contents), |
33 weak_java_observer_(env, obj){ | 33 weak_java_observer_(env, obj){ |
34 } | 34 } |
35 | 35 |
36 WebContentsObserverAndroid::~WebContentsObserverAndroid() { | 36 WebContentsObserverAndroid::~WebContentsObserverAndroid() { |
37 } | 37 } |
38 | 38 |
39 jint Init(JNIEnv* env, jobject obj, jint native_content_view_core) { | 39 jlong Init(JNIEnv* env, jobject obj, jlong native_content_view_core) { |
40 ContentViewCore* content_view_core = | 40 ContentViewCore* content_view_core = |
41 reinterpret_cast<ContentViewCore*>(native_content_view_core); | 41 reinterpret_cast<ContentViewCore*>(native_content_view_core); |
42 WebContentsObserverAndroid* native_observer = new WebContentsObserverAndroid( | 42 WebContentsObserverAndroid* native_observer = new WebContentsObserverAndroid( |
43 env, obj, content_view_core->GetWebContents()); | 43 env, obj, content_view_core->GetWebContents()); |
44 return reinterpret_cast<jint>(native_observer); | 44 return reinterpret_cast<intptr_t>(native_observer); |
45 } | 45 } |
46 | 46 |
47 void WebContentsObserverAndroid::Destroy(JNIEnv* env, jobject obj) { | 47 void WebContentsObserverAndroid::Destroy(JNIEnv* env, jobject obj) { |
48 delete this; | 48 delete this; |
49 } | 49 } |
50 | 50 |
51 void WebContentsObserverAndroid::WebContentsDestroyed( | 51 void WebContentsObserverAndroid::WebContentsDestroyed( |
52 WebContents* web_contents) { | 52 WebContents* web_contents) { |
53 JNIEnv* env = AttachCurrentThread(); | 53 JNIEnv* env = AttachCurrentThread(); |
54 ScopedJavaLocalRef<jobject> obj(weak_java_observer_.get(env)); | 54 ScopedJavaLocalRef<jobject> obj(weak_java_observer_.get(env)); |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 is_provisional_load, | 270 is_provisional_load, |
271 is_main_frame, | 271 is_main_frame, |
272 error_code, | 272 error_code, |
273 jstring_error_description.obj(), jstring_url.obj()); | 273 jstring_error_description.obj(), jstring_url.obj()); |
274 } | 274 } |
275 | 275 |
276 bool RegisterWebContentsObserverAndroid(JNIEnv* env) { | 276 bool RegisterWebContentsObserverAndroid(JNIEnv* env) { |
277 return RegisterNativesImpl(env); | 277 return RegisterNativesImpl(env); |
278 } | 278 } |
279 } // namespace content | 279 } // namespace content |
OLD | NEW |