| 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 void ViewAndroid::StartContentIntent(const GURL& content_url, | |
| 275 bool is_main_frame) { | |
| 276 ScopedJavaLocalRef<jobject> delegate(GetViewAndroidDelegate()); | |
| 277 if (delegate.is_null()) | |
| 278 return; | |
| 279 JNIEnv* env = base::android::AttachCurrentThread(); | |
| 280 ScopedJavaLocalRef<jstring> jcontent_url = | |
| 281 ConvertUTF8ToJavaString(env, content_url.spec()); | |
| 282 Java_ViewAndroidDelegate_onStartContentIntent(env, delegate, jcontent_url, | |
| 283 is_main_frame); | |
| 284 } | |
| 285 | |
| 286 bool ViewAndroid::OnTouchEvent(const MotionEventAndroid& event, | 274 bool ViewAndroid::OnTouchEvent(const MotionEventAndroid& event, |
| 287 bool for_touch_handle) { | 275 bool for_touch_handle) { |
| 288 return HitTest( | 276 return HitTest( |
| 289 base::Bind(&ViewAndroid::SendTouchEventToClient, for_touch_handle), | 277 base::Bind(&ViewAndroid::SendTouchEventToClient, for_touch_handle), |
| 290 event); | 278 event); |
| 291 } | 279 } |
| 292 | 280 |
| 293 bool ViewAndroid::SendTouchEventToClient(bool for_touch_handle, | 281 bool ViewAndroid::SendTouchEventToClient(bool for_touch_handle, |
| 294 ViewClient* client, | 282 ViewClient* client, |
| 295 const MotionEventAndroid& event) { | 283 const MotionEventAndroid& event) { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 matched = bound.Contains(e->GetX(0), e->GetY(0)); | 324 matched = bound.Contains(e->GetX(0), e->GetY(0)); |
| 337 } | 325 } |
| 338 if (matched && child->HitTest(send_to_client, *e)) | 326 if (matched && child->HitTest(send_to_client, *e)) |
| 339 return true; | 327 return true; |
| 340 } | 328 } |
| 341 } | 329 } |
| 342 return false; | 330 return false; |
| 343 } | 331 } |
| 344 | 332 |
| 345 } // namespace ui | 333 } // namespace ui |
| OLD | NEW |