| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/web_contents/web_contents_android.h" | 5 #include "content/browser/web_contents/web_contents_android.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.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 28 matching lines...) Expand all Loading... |
| 39 #include "ui/gfx/android/device_display_info.h" | 39 #include "ui/gfx/android/device_display_info.h" |
| 40 #include "ui/gfx/android/java_bitmap.h" | 40 #include "ui/gfx/android/java_bitmap.h" |
| 41 #include "ui/gfx/geometry/rect.h" | 41 #include "ui/gfx/geometry/rect.h" |
| 42 | 42 |
| 43 using base::android::AttachCurrentThread; | 43 using base::android::AttachCurrentThread; |
| 44 using base::android::ConvertJavaStringToUTF8; | 44 using base::android::ConvertJavaStringToUTF8; |
| 45 using base::android::ConvertJavaStringToUTF16; | 45 using base::android::ConvertJavaStringToUTF16; |
| 46 using base::android::ConvertUTF8ToJavaString; | 46 using base::android::ConvertUTF8ToJavaString; |
| 47 using base::android::ConvertUTF16ToJavaString; | 47 using base::android::ConvertUTF16ToJavaString; |
| 48 using base::android::JavaParamRef; | 48 using base::android::JavaParamRef; |
| 49 using base::android::JavaRef; |
| 49 using base::android::ScopedJavaGlobalRef; | 50 using base::android::ScopedJavaGlobalRef; |
| 50 using base::android::ScopedJavaLocalRef; | 51 using base::android::ScopedJavaLocalRef; |
| 51 using base::android::ToJavaIntArray; | 52 using base::android::ToJavaIntArray; |
| 52 | 53 |
| 53 namespace content { | 54 namespace content { |
| 54 | 55 |
| 55 namespace { | 56 namespace { |
| 56 | 57 |
| 57 // Track all WebContentsAndroid objects here so that we don't deserialize a | 58 // Track all WebContentsAndroid objects here so that we don't deserialize a |
| 58 // destroyed WebContents object. | 59 // destroyed WebContents object. |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 gfx::Rect parent_rect; | 175 gfx::Rect parent_rect; |
| 175 ScopedJavaLocalRef<jobject> j_root = | 176 ScopedJavaLocalRef<jobject> j_root = |
| 176 WalkAXTreeDepthFirst(env, root, parent_rect, ¶ms); | 177 WalkAXTreeDepthFirst(env, root, parent_rect, ¶ms); |
| 177 Java_WebContentsImpl_onAccessibilitySnapshot(env, j_root, callback); | 178 Java_WebContentsImpl_onAccessibilitySnapshot(env, j_root, callback); |
| 178 } | 179 } |
| 179 | 180 |
| 180 } // namespace | 181 } // namespace |
| 181 | 182 |
| 182 // static | 183 // static |
| 183 WebContents* WebContents::FromJavaWebContents( | 184 WebContents* WebContents::FromJavaWebContents( |
| 184 jobject jweb_contents_android) { | 185 const JavaRef<jobject>& jweb_contents_android) { |
| 185 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 186 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 186 if (!jweb_contents_android) | 187 if (jweb_contents_android.is_null()) |
| 187 return NULL; | 188 return NULL; |
| 188 | 189 |
| 189 WebContentsAndroid* web_contents_android = | 190 WebContentsAndroid* web_contents_android = |
| 190 reinterpret_cast<WebContentsAndroid*>( | 191 reinterpret_cast<WebContentsAndroid*>( |
| 191 Java_WebContentsImpl_getNativePointer(AttachCurrentThread(), | 192 Java_WebContentsImpl_getNativePointer(AttachCurrentThread(), |
| 192 jweb_contents_android)); | 193 jweb_contents_android)); |
| 193 if (!web_contents_android) | 194 if (!web_contents_android) |
| 194 return NULL; | 195 return NULL; |
| 195 return web_contents_android->web_contents(); | 196 return web_contents_android->web_contents(); |
| 196 } | 197 } |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 } | 721 } |
| 721 for (const gfx::Size& size : sizes) { | 722 for (const gfx::Size& size : sizes) { |
| 722 Java_WebContentsImpl_createSizeAndAddToList(env, jsizes, size.width(), | 723 Java_WebContentsImpl_createSizeAndAddToList(env, jsizes, size.width(), |
| 723 size.height()); | 724 size.height()); |
| 724 } | 725 } |
| 725 Java_WebContentsImpl_onDownloadImageFinished(env, obj->obj(), callback->obj(), | 726 Java_WebContentsImpl_onDownloadImageFinished(env, obj->obj(), callback->obj(), |
| 726 id, http_status_code, jurl, | 727 id, http_status_code, jurl, |
| 727 jbitmaps, jsizes); | 728 jbitmaps, jsizes); |
| 728 } | 729 } |
| 729 } // namespace content | 730 } // namespace content |
| OLD | NEW |