OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ui/android/view_android.h" | 5 #include "ui/android/view_android.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 void ViewAndroid::OnBottomControlsChanged(float bottom_controls_offset, | 264 void ViewAndroid::OnBottomControlsChanged(float bottom_controls_offset, |
265 float bottom_content_offset) { | 265 float bottom_content_offset) { |
266 ScopedJavaLocalRef<jobject> delegate(GetViewAndroidDelegate()); | 266 ScopedJavaLocalRef<jobject> delegate(GetViewAndroidDelegate()); |
267 if (delegate.is_null()) | 267 if (delegate.is_null()) |
268 return; | 268 return; |
269 JNIEnv* env = base::android::AttachCurrentThread(); | 269 JNIEnv* env = base::android::AttachCurrentThread(); |
270 Java_ViewAndroidDelegate_onBottomControlsChanged( | 270 Java_ViewAndroidDelegate_onBottomControlsChanged( |
271 env, delegate, bottom_controls_offset, bottom_content_offset); | 271 env, delegate, bottom_controls_offset, bottom_content_offset); |
272 } | 272 } |
273 | 273 |
274 int ViewAndroid::GetSystemWindowInsetBottom() { | |
275 ScopedJavaLocalRef<jobject> delegate(GetViewAndroidDelegate()); | |
276 if (delegate.is_null()) | |
277 return 0; | |
278 JNIEnv* env = base::android::AttachCurrentThread(); | |
279 return Java_ViewAndroidDelegate_getSystemWindowInsetBottom(env, delegate); | |
280 } | |
281 | |
282 bool ViewAndroid::OnTouchEvent(const MotionEventAndroid& event, | 274 bool ViewAndroid::OnTouchEvent(const MotionEventAndroid& event, |
283 bool for_touch_handle) { | 275 bool for_touch_handle) { |
284 return HitTest( | 276 return HitTest( |
285 base::Bind(&ViewAndroid::SendTouchEventToClient, for_touch_handle), | 277 base::Bind(&ViewAndroid::SendTouchEventToClient, for_touch_handle), |
286 event); | 278 event); |
287 } | 279 } |
288 | 280 |
289 bool ViewAndroid::SendTouchEventToClient(bool for_touch_handle, | 281 bool ViewAndroid::SendTouchEventToClient(bool for_touch_handle, |
290 ViewClient* client, | 282 ViewClient* client, |
291 const MotionEventAndroid& event) { | 283 const MotionEventAndroid& event) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 matched = bound.Contains(e->GetX(0), e->GetY(0)); | 324 matched = bound.Contains(e->GetX(0), e->GetY(0)); |
333 } | 325 } |
334 if (matched && child->HitTest(send_to_client, *e)) | 326 if (matched && child->HitTest(send_to_client, *e)) |
335 return true; | 327 return true; |
336 } | 328 } |
337 } | 329 } |
338 return false; | 330 return false; |
339 } | 331 } |
340 | 332 |
341 } // namespace ui | 333 } // namespace ui |
OLD | NEW |