Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(503)

Side by Side Diff: android_webview/native/aw_contents.cc

Issue 475633002: Pass TouchMajor to HitTestResult (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 #include "content/public/browser/render_process_host.h" 57 #include "content/public/browser/render_process_host.h"
58 #include "content/public/browser/render_view_host.h" 58 #include "content/public/browser/render_view_host.h"
59 #include "content/public/browser/web_contents.h" 59 #include "content/public/browser/web_contents.h"
60 #include "content/public/common/renderer_preferences.h" 60 #include "content/public/common/renderer_preferences.h"
61 #include "content/public/common/ssl_status.h" 61 #include "content/public/common/ssl_status.h"
62 #include "jni/AwContents_jni.h" 62 #include "jni/AwContents_jni.h"
63 #include "net/base/auth.h" 63 #include "net/base/auth.h"
64 #include "net/cert/x509_certificate.h" 64 #include "net/cert/x509_certificate.h"
65 #include "third_party/skia/include/core/SkPicture.h" 65 #include "third_party/skia/include/core/SkPicture.h"
66 #include "ui/gfx/android/java_bitmap.h" 66 #include "ui/gfx/android/java_bitmap.h"
67 #include "ui/gfx/geometry/rect_f.h"
67 #include "ui/gfx/image/image.h" 68 #include "ui/gfx/image/image.h"
68 #include "ui/gfx/size.h" 69 #include "ui/gfx/size.h"
69 70
70 struct AwDrawSWFunctionTable; 71 struct AwDrawSWFunctionTable;
71 struct AwDrawGLFunctionTable; 72 struct AwDrawGLFunctionTable;
72 73
73 using autofill::ContentAutofillDriver; 74 using autofill::ContentAutofillDriver;
74 using autofill::AutofillManager; 75 using autofill::AutofillManager;
75 using base::android::AttachCurrentThread; 76 using base::android::AttachCurrentThread;
76 using base::android::ConvertJavaStringToUTF16; 77 using base::android::ConvertJavaStringToUTF16;
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 if (!ok) 802 if (!ok)
802 return ScopedJavaLocalRef<jbyteArray>(); 803 return ScopedJavaLocalRef<jbyteArray>();
803 804
804 // Convert the certificate and return it 805 // Convert the certificate and return it
805 std::string der_string; 806 std::string der_string;
806 net::X509Certificate::GetDEREncoded(cert->os_cert_handle(), &der_string); 807 net::X509Certificate::GetDEREncoded(cert->os_cert_handle(), &der_string);
807 return base::android::ToJavaByteArray(env, 808 return base::android::ToJavaByteArray(env,
808 reinterpret_cast<const uint8*>(der_string.data()), der_string.length()); 809 reinterpret_cast<const uint8*>(der_string.data()), der_string.length());
809 } 810 }
810 811
811 void AwContents::RequestNewHitTestDataAt(JNIEnv* env, jobject obj, 812 void AwContents::RequestNewHitTestDataAt(JNIEnv* env,
812 jint x, jint y) { 813 jobject obj,
814 jint x,
815 jint y,
816 jfloat touch_major,
817 jfloat touch_minor) {
813 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 818 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
814 render_view_host_ext_->RequestNewHitTestDataAt(x, y); 819 gfx::RectF touch_area(x, y, touch_major / 2, touch_minor / 2);
jdduke (slow) 2014/10/30 19:54:58 x/y here correspond to the *center* of the rect, b
hush (inactive) 2014/11/04 01:55:57 I agree this is weird. (you mentioned this in a co
hush (inactive) 2014/11/04 02:50:47 Sorry. Scratch that. Blink does the half resize fo
820 render_view_host_ext_->RequestNewHitTestDataAt(touch_area);
815 } 821 }
816 822
817 void AwContents::UpdateLastHitTestData(JNIEnv* env, jobject obj) { 823 void AwContents::UpdateLastHitTestData(JNIEnv* env, jobject obj) {
818 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 824 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
819 if (!render_view_host_ext_->HasNewHitTestData()) return; 825 if (!render_view_host_ext_->HasNewHitTestData()) return;
820 826
821 const AwHitTestData& data = render_view_host_ext_->GetLastHitTestData(); 827 const AwHitTestData& data = render_view_host_ext_->GetLastHitTestData();
822 render_view_host_ext_->MarkHitTestDataRead(); 828 render_view_host_ext_->MarkHitTestDataRead();
823 829
824 // Make sure to null the Java object if data is empty/invalid. 830 // Make sure to null the Java object if data is empty/invalid.
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 } 1175 }
1170 1176
1171 browser_view_renderer_.TrimMemory(level, visible); 1177 browser_view_renderer_.TrimMemory(level, visible);
1172 } 1178 }
1173 1179
1174 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { 1180 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) {
1175 g_should_download_favicons = true; 1181 g_should_download_favicons = true;
1176 } 1182 }
1177 1183
1178 } // namespace android_webview 1184 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698