| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "android_webview/native/aw_contents.h" | 5 #include "android_webview/native/aw_contents.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "android_webview/browser/aw_browser_context.h" | 9 #include "android_webview/browser/aw_browser_context.h" |
| 10 #include "android_webview/browser/aw_browser_main_parts.h" | 10 #include "android_webview/browser/aw_browser_main_parts.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 #include "content/public/browser/render_process_host.h" | 59 #include "content/public/browser/render_process_host.h" |
| 60 #include "content/public/browser/render_view_host.h" | 60 #include "content/public/browser/render_view_host.h" |
| 61 #include "content/public/browser/web_contents.h" | 61 #include "content/public/browser/web_contents.h" |
| 62 #include "content/public/common/renderer_preferences.h" | 62 #include "content/public/common/renderer_preferences.h" |
| 63 #include "content/public/common/ssl_status.h" | 63 #include "content/public/common/ssl_status.h" |
| 64 #include "jni/AwContents_jni.h" | 64 #include "jni/AwContents_jni.h" |
| 65 #include "net/base/auth.h" | 65 #include "net/base/auth.h" |
| 66 #include "net/cert/x509_certificate.h" | 66 #include "net/cert/x509_certificate.h" |
| 67 #include "third_party/skia/include/core/SkPicture.h" | 67 #include "third_party/skia/include/core/SkPicture.h" |
| 68 #include "ui/gfx/android/java_bitmap.h" | 68 #include "ui/gfx/android/java_bitmap.h" |
| 69 #include "ui/gfx/geometry/rect_f.h" |
| 69 #include "ui/gfx/image/image.h" | 70 #include "ui/gfx/image/image.h" |
| 70 #include "ui/gfx/size.h" | 71 #include "ui/gfx/size.h" |
| 71 | 72 |
| 72 struct AwDrawSWFunctionTable; | 73 struct AwDrawSWFunctionTable; |
| 73 | 74 |
| 74 using autofill::ContentAutofillDriver; | 75 using autofill::ContentAutofillDriver; |
| 75 using autofill::AutofillManager; | 76 using autofill::AutofillManager; |
| 76 using base::android::AttachCurrentThread; | 77 using base::android::AttachCurrentThread; |
| 77 using base::android::ConvertJavaStringToUTF16; | 78 using base::android::ConvertJavaStringToUTF16; |
| 78 using base::android::ConvertJavaStringToUTF8; | 79 using base::android::ConvertJavaStringToUTF8; |
| (...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 if (!ok) | 718 if (!ok) |
| 718 return ScopedJavaLocalRef<jbyteArray>(); | 719 return ScopedJavaLocalRef<jbyteArray>(); |
| 719 | 720 |
| 720 // Convert the certificate and return it | 721 // Convert the certificate and return it |
| 721 std::string der_string; | 722 std::string der_string; |
| 722 net::X509Certificate::GetDEREncoded(cert->os_cert_handle(), &der_string); | 723 net::X509Certificate::GetDEREncoded(cert->os_cert_handle(), &der_string); |
| 723 return base::android::ToJavaByteArray(env, | 724 return base::android::ToJavaByteArray(env, |
| 724 reinterpret_cast<const uint8*>(der_string.data()), der_string.length()); | 725 reinterpret_cast<const uint8*>(der_string.data()), der_string.length()); |
| 725 } | 726 } |
| 726 | 727 |
| 727 void AwContents::RequestNewHitTestDataAt(JNIEnv* env, jobject obj, | 728 void AwContents::RequestNewHitTestDataAt(JNIEnv* env, |
| 728 jint x, jint y) { | 729 jobject obj, |
| 730 jfloat x, |
| 731 jfloat y, |
| 732 jfloat touch_major) { |
| 729 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 733 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 730 render_view_host_ext_->RequestNewHitTestDataAt(x, y); | 734 gfx::PointF touch_center(x, y); |
| 735 gfx::SizeF touch_area(touch_major, touch_major); |
| 736 render_view_host_ext_->RequestNewHitTestDataAt(touch_center, touch_area); |
| 731 } | 737 } |
| 732 | 738 |
| 733 void AwContents::UpdateLastHitTestData(JNIEnv* env, jobject obj) { | 739 void AwContents::UpdateLastHitTestData(JNIEnv* env, jobject obj) { |
| 734 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 740 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 735 if (!render_view_host_ext_->HasNewHitTestData()) return; | 741 if (!render_view_host_ext_->HasNewHitTestData()) return; |
| 736 | 742 |
| 737 const AwHitTestData& data = render_view_host_ext_->GetLastHitTestData(); | 743 const AwHitTestData& data = render_view_host_ext_->GetLastHitTestData(); |
| 738 render_view_host_ext_->MarkHitTestDataRead(); | 744 render_view_host_ext_->MarkHitTestDataRead(); |
| 739 | 745 |
| 740 // Make sure to null the Java object if data is empty/invalid. | 746 // Make sure to null the Java object if data is empty/invalid. |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1048 jboolean visible) { | 1054 jboolean visible) { |
| 1049 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1055 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1050 browser_view_renderer_.TrimMemory(level, visible); | 1056 browser_view_renderer_.TrimMemory(level, visible); |
| 1051 } | 1057 } |
| 1052 | 1058 |
| 1053 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { | 1059 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { |
| 1054 g_should_download_favicons = true; | 1060 g_should_download_favicons = true; |
| 1055 } | 1061 } |
| 1056 | 1062 |
| 1057 } // namespace android_webview | 1063 } // namespace android_webview |
| OLD | NEW |