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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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)); |
55 if (obj.is_null()) { | 55 if (obj.is_null()) { |
56 delete this; | 56 delete this; |
57 } else { | 57 } else { |
58 // The java side will destroy |this| | 58 // The java side will destroy |this| |
59 Java_WebContentsObserverAndroid_detachFromWebContents(env, obj.obj()); | 59 Java_WebContentsObserverAndroid_detachFromWebContents(env, obj.obj()); |
60 } | 60 } |
61 } | 61 } |
62 | 62 |
63 void WebContentsObserverAndroid::RenderProcessGone( | |
64 base::TerminationStatus termination_status) { | |
jar (doing other things)
2013/11/06 19:27:26
nit: 4 character indent from previous line's "v" i
ppi
2013/11/06 20:14:06
Done.
| |
65 JNIEnv* env = AttachCurrentThread(); | |
66 ScopedJavaLocalRef<jobject> obj(weak_java_observer_.get(env)); | |
67 if (obj.is_null()) | |
68 return; | |
69 jboolean was_oom_protected = | |
70 termination_status == base::TERMINATION_STATUS_OOM_PROTECTED; | |
71 Java_WebContentsObserverAndroid_renderProcessGone( | |
72 env, obj.obj(), was_oom_protected); | |
73 } | |
74 | |
63 void WebContentsObserverAndroid::DidStartLoading( | 75 void WebContentsObserverAndroid::DidStartLoading( |
64 RenderViewHost* render_view_host) { | 76 RenderViewHost* render_view_host) { |
65 JNIEnv* env = AttachCurrentThread(); | 77 JNIEnv* env = AttachCurrentThread(); |
66 ScopedJavaLocalRef<jobject> obj(weak_java_observer_.get(env)); | 78 ScopedJavaLocalRef<jobject> obj(weak_java_observer_.get(env)); |
67 if (obj.is_null()) | 79 if (obj.is_null()) |
68 return; | 80 return; |
69 ScopedJavaLocalRef<jstring> jstring_url(ConvertUTF8ToJavaString( | 81 ScopedJavaLocalRef<jstring> jstring_url(ConvertUTF8ToJavaString( |
70 env, web_contents()->GetVisibleURL().spec())); | 82 env, web_contents()->GetVisibleURL().spec())); |
71 Java_WebContentsObserverAndroid_didStartLoading( | 83 Java_WebContentsObserverAndroid_didStartLoading( |
72 env, obj.obj(), jstring_url.obj()); | 84 env, obj.obj(), jstring_url.obj()); |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
258 is_provisional_load, | 270 is_provisional_load, |
259 is_main_frame, | 271 is_main_frame, |
260 error_code, | 272 error_code, |
261 jstring_error_description.obj(), jstring_url.obj()); | 273 jstring_error_description.obj(), jstring_url.obj()); |
262 } | 274 } |
263 | 275 |
264 bool RegisterWebContentsObserverAndroid(JNIEnv* env) { | 276 bool RegisterWebContentsObserverAndroid(JNIEnv* env) { |
265 return RegisterNativesImpl(env); | 277 return RegisterNativesImpl(env); |
266 } | 278 } |
267 } // namespace content | 279 } // namespace content |
OLD | NEW |