| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 JNIEnv* env = AttachCurrentThread(); | 88 JNIEnv* env = AttachCurrentThread(); |
| 89 ScopedJavaLocalRef<jobject> obj(weak_java_observer_.get(env)); | 89 ScopedJavaLocalRef<jobject> obj(weak_java_observer_.get(env)); |
| 90 if (obj.is_null()) | 90 if (obj.is_null()) |
| 91 return; | 91 return; |
| 92 ScopedJavaLocalRef<jstring> jstring_url(ConvertUTF8ToJavaString( | 92 ScopedJavaLocalRef<jstring> jstring_url(ConvertUTF8ToJavaString( |
| 93 env, web_contents()->GetLastCommittedURL().spec())); | 93 env, web_contents()->GetLastCommittedURL().spec())); |
| 94 Java_WebContentsObserverAndroid_didStopLoading( | 94 Java_WebContentsObserverAndroid_didStopLoading( |
| 95 env, obj.obj(), jstring_url.obj()); | 95 env, obj.obj(), jstring_url.obj()); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void WebContentsObserverAndroid::DidDeferAfterResponseStarted() { |
| 99 JNIEnv* env = AttachCurrentThread(); |
| 100 ScopedJavaLocalRef<jobject> obj(weak_java_observer_.get(env)); |
| 101 if (obj.is_null()) |
| 102 return; |
| 103 Java_WebContentsObserverAndroid_didDeferAfterResponseStarted(env, obj.obj()); |
| 104 } |
| 105 |
| 98 void WebContentsObserverAndroid::DidFailProvisionalLoad( | 106 void WebContentsObserverAndroid::DidFailProvisionalLoad( |
| 99 int64 frame_id, | 107 int64 frame_id, |
| 100 const base::string16& frame_unique_name, | 108 const base::string16& frame_unique_name, |
| 101 bool is_main_frame, | 109 bool is_main_frame, |
| 102 const GURL& validated_url, | 110 const GURL& validated_url, |
| 103 int error_code, | 111 int error_code, |
| 104 const base::string16& error_description, | 112 const base::string16& error_description, |
| 105 RenderViewHost* render_view_host) { | 113 RenderViewHost* render_view_host) { |
| 106 DidFailLoadInternal( | 114 DidFailLoadInternal( |
| 107 true, is_main_frame, error_code, error_description, validated_url); | 115 true, is_main_frame, error_code, error_description, validated_url); |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 if (obj.is_null()) | 286 if (obj.is_null()) |
| 279 return; | 287 return; |
| 280 Java_WebContentsObserverAndroid_didFirstVisuallyNonEmptyPaint( | 288 Java_WebContentsObserverAndroid_didFirstVisuallyNonEmptyPaint( |
| 281 env, obj.obj()); | 289 env, obj.obj()); |
| 282 } | 290 } |
| 283 | 291 |
| 284 bool RegisterWebContentsObserverAndroid(JNIEnv* env) { | 292 bool RegisterWebContentsObserverAndroid(JNIEnv* env) { |
| 285 return RegisterNativesImpl(env); | 293 return RegisterNativesImpl(env); |
| 286 } | 294 } |
| 287 } // namespace content | 295 } // namespace content |
| OLD | NEW |