| 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 } | 170 } |
| 171 | 171 |
| 172 void WebContentsDelegateAndroid::LoadingStateChanged(WebContents* source, | 172 void WebContentsDelegateAndroid::LoadingStateChanged(WebContents* source, |
| 173 bool to_different_document) { | 173 bool to_different_document) { |
| 174 JNIEnv* env = AttachCurrentThread(); | 174 JNIEnv* env = AttachCurrentThread(); |
| 175 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); | 175 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); |
| 176 if (obj.is_null()) | 176 if (obj.is_null()) |
| 177 return; | 177 return; |
| 178 bool has_stopped = source == NULL || !source->IsLoading(); | 178 bool has_stopped = source == NULL || !source->IsLoading(); |
| 179 | 179 |
| 180 if (has_stopped) | 180 if (has_stopped) { |
| 181 Java_WebContentsDelegateAndroid_onLoadStopped(env, obj.obj()); | 181 Java_WebContentsDelegateAndroid_onLoadStopped(env, obj.obj()); |
| 182 else | 182 } else { |
| 183 Java_WebContentsDelegateAndroid_onLoadStarted(env, obj.obj()); | 183 Java_WebContentsDelegateAndroid_onLoadStarted( |
| 184 env, |
| 185 obj.obj(), |
| 186 to_different_document); |
| 187 } |
| 184 } | 188 } |
| 185 | 189 |
| 186 void WebContentsDelegateAndroid::LoadProgressChanged(WebContents* source, | 190 void WebContentsDelegateAndroid::LoadProgressChanged(WebContents* source, |
| 187 double progress) { | 191 double progress) { |
| 188 JNIEnv* env = AttachCurrentThread(); | 192 JNIEnv* env = AttachCurrentThread(); |
| 189 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); | 193 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); |
| 190 if (obj.is_null()) | 194 if (obj.is_null()) |
| 191 return; | 195 return; |
| 192 Java_WebContentsDelegateAndroid_notifyLoadProgressChanged( | 196 Java_WebContentsDelegateAndroid_notifyLoadProgressChanged( |
| 193 env, | 197 env, |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 // Native JNI methods | 438 // Native JNI methods |
| 435 // ---------------------------------------------------------------------------- | 439 // ---------------------------------------------------------------------------- |
| 436 | 440 |
| 437 // Register native methods | 441 // Register native methods |
| 438 | 442 |
| 439 bool RegisterWebContentsDelegateAndroid(JNIEnv* env) { | 443 bool RegisterWebContentsDelegateAndroid(JNIEnv* env) { |
| 440 return RegisterNativesImpl(env); | 444 return RegisterNativesImpl(env); |
| 441 } | 445 } |
| 442 | 446 |
| 443 } // namespace web_contents_delegate_android | 447 } // namespace web_contents_delegate_android |
| OLD | NEW |