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 "components/web_contents_delegate_android/web_contents_delegate_android
.h" | 5 #include "components/web_contents_delegate_android/web_contents_delegate_android
.h" |
6 | 6 |
7 #include <android/keycodes.h> | 7 #include <android/keycodes.h> |
8 | 8 |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/jni_array.h" | 10 #include "base/android/jni_array.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); | 152 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); |
153 if (obj.is_null()) | 153 if (obj.is_null()) |
154 return; | 154 return; |
155 Java_WebContentsDelegateAndroid_activateContents(env, obj.obj()); | 155 Java_WebContentsDelegateAndroid_activateContents(env, obj.obj()); |
156 } | 156 } |
157 | 157 |
158 void WebContentsDelegateAndroid::LoadingStateChanged(WebContents* source, | 158 void WebContentsDelegateAndroid::LoadingStateChanged(WebContents* source, |
159 bool to_different_document) { | 159 bool to_different_document) { |
160 JNIEnv* env = AttachCurrentThread(); | 160 JNIEnv* env = AttachCurrentThread(); |
161 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); | 161 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); |
162 if (obj.is_null()) | 162 Java_WebContentsDelegateAndroid_loadingStateChanged(env, |
163 return; | 163 obj.obj(), |
164 bool has_stopped = source == NULL || !source->IsLoading(); | 164 to_different_document); |
165 | |
166 if (has_stopped) { | |
167 Java_WebContentsDelegateAndroid_onLoadStopped(env, obj.obj()); | |
168 } else { | |
169 Java_WebContentsDelegateAndroid_onLoadStarted( | |
170 env, | |
171 obj.obj(), | |
172 to_different_document); | |
173 } | |
174 } | 165 } |
175 | 166 |
176 void WebContentsDelegateAndroid::LoadProgressChanged(WebContents* source, | 167 void WebContentsDelegateAndroid::LoadProgressChanged(WebContents* source, |
177 double progress) { | 168 double progress) { |
178 JNIEnv* env = AttachCurrentThread(); | 169 JNIEnv* env = AttachCurrentThread(); |
179 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); | 170 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); |
180 if (obj.is_null()) | 171 if (obj.is_null()) |
181 return; | 172 return; |
182 Java_WebContentsDelegateAndroid_notifyLoadProgressChanged( | 173 Java_WebContentsDelegateAndroid_notifyLoadProgressChanged( |
183 env, | 174 env, |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 // Native JNI methods | 420 // Native JNI methods |
430 // ---------------------------------------------------------------------------- | 421 // ---------------------------------------------------------------------------- |
431 | 422 |
432 // Register native methods | 423 // Register native methods |
433 | 424 |
434 bool RegisterWebContentsDelegateAndroid(JNIEnv* env) { | 425 bool RegisterWebContentsDelegateAndroid(JNIEnv* env) { |
435 return RegisterNativesImpl(env); | 426 return RegisterNativesImpl(env); |
436 } | 427 } |
437 | 428 |
438 } // namespace web_contents_delegate_android | 429 } // namespace web_contents_delegate_android |
OLD | NEW |