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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
130 ScopedJavaLocalRef<jstring> jstring_url = | 130 ScopedJavaLocalRef<jstring> jstring_url = |
131 ConvertUTF8ToJavaString(env, params.url.spec()); | 131 ConvertUTF8ToJavaString(env, params.url.spec()); |
132 ScopedJavaLocalRef<jstring> jstring_base_url = | 132 ScopedJavaLocalRef<jstring> jstring_base_url = |
133 ConvertUTF8ToJavaString(env, params.base_url.spec()); | 133 ConvertUTF8ToJavaString(env, params.base_url.spec()); |
134 jboolean jboolean_is_reload = PAGE_TRANSITION_RELOAD == params.transition; | 134 jboolean jboolean_is_reload = PAGE_TRANSITION_RELOAD == params.transition; |
135 Java_WebContentsObserverAndroid_didNavigateAnyFrame( | 135 Java_WebContentsObserverAndroid_didNavigateAnyFrame( |
136 env, obj.obj(), jstring_url.obj(), jstring_base_url.obj(), | 136 env, obj.obj(), jstring_url.obj(), jstring_base_url.obj(), |
137 jboolean_is_reload); | 137 jboolean_is_reload); |
138 } | 138 } |
139 | 139 |
140 void WebContentsObserverAndroid::DidStartProvisionalLoadForFrame( | |
141 int64 frame_id, | |
142 int64 parent_frame_id, | |
143 bool is_main_frame, | |
144 const GURL& validated_url, | |
145 bool is_error_page, | |
146 bool is_iframe_srcdoc, | |
147 RenderViewHost* render_view_host) { | |
148 JNIEnv* env = AttachCurrentThread(); | |
149 ScopedJavaLocalRef<jobject> obj = weak_java_observer_.get(env); | |
David Trainor- moved to gerrit
2013/01/08 22:22:18
maybe use obj(...); (copy constructor?)
Ted C
2013/01/08 22:43:17
Done.
| |
150 if (obj.is_null()) | |
151 return; | |
152 ScopedJavaLocalRef<jstring> jstring_url = | |
David Trainor- moved to gerrit
2013/01/08 22:22:18
copy constructor?
Ted C
2013/01/08 22:43:17
Done. Updated other usages in this file to keep u
| |
153 ConvertUTF8ToJavaString(env, validated_url.spec()); | |
154 Java_WebContentsObserverAndroid_didStartProvisionalLoadForFrame( | |
155 env, obj.obj(), frame_id, parent_frame_id, is_main_frame, | |
156 jstring_url.obj(), is_error_page, is_iframe_srcdoc); | |
157 } | |
158 | |
140 void WebContentsObserverAndroid::DidFailLoadInternal( | 159 void WebContentsObserverAndroid::DidFailLoadInternal( |
141 bool is_provisional_load, | 160 bool is_provisional_load, |
142 bool is_main_frame, | 161 bool is_main_frame, |
143 int error_code, | 162 int error_code, |
144 const string16& description, | 163 const string16& description, |
145 const GURL& url) { | 164 const GURL& url) { |
146 JNIEnv* env = AttachCurrentThread(); | 165 JNIEnv* env = AttachCurrentThread(); |
147 ScopedJavaLocalRef<jobject> obj = weak_java_observer_.get(env); | 166 ScopedJavaLocalRef<jobject> obj = weak_java_observer_.get(env); |
148 if (obj.is_null()) | 167 if (obj.is_null()) |
149 return; | 168 return; |
(...skipping 11 matching lines...) Expand all Loading... | |
161 } | 180 } |
162 | 181 |
163 bool RegisterWebContentsObserverAndroid(JNIEnv* env) { | 182 bool RegisterWebContentsObserverAndroid(JNIEnv* env) { |
164 if (!HasClass(env, kWebContentsObserverAndroidClassPath)) { | 183 if (!HasClass(env, kWebContentsObserverAndroidClassPath)) { |
165 DLOG(ERROR) << "Unable to find class WebContentsObserverAndroid!"; | 184 DLOG(ERROR) << "Unable to find class WebContentsObserverAndroid!"; |
166 return false; | 185 return false; |
167 } | 186 } |
168 return RegisterNativesImpl(env); | 187 return RegisterNativesImpl(env); |
169 } | 188 } |
170 } // namespace content | 189 } // namespace content |
OLD | NEW |