| 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 "chrome/browser/android/vr_shell/vr_shell.h" | 5 #include "chrome/browser/android/vr_shell/vr_shell.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
| 8 #include "chrome/browser/android/vr_shell/ui_elements.h" | 8 #include "chrome/browser/android/vr_shell/ui_elements.h" |
| 9 #include "chrome/browser/android/vr_shell/ui_interface.h" | 9 #include "chrome/browser/android/vr_shell/ui_interface.h" |
| 10 #include "chrome/browser/android/vr_shell/ui_scene.h" | 10 #include "chrome/browser/android/vr_shell/ui_scene.h" |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 // TODO(asimjour) for now, scroll is sent to the main content. | 494 // TODO(asimjour) for now, scroll is sent to the main content. |
| 495 if (gesture->type == WebInputEvent::GestureScrollBegin || | 495 if (gesture->type == WebInputEvent::GestureScrollBegin || |
| 496 gesture->type == WebInputEvent::GestureScrollUpdate || | 496 gesture->type == WebInputEvent::GestureScrollUpdate || |
| 497 gesture->type == WebInputEvent::GestureScrollEnd || | 497 gesture->type == WebInputEvent::GestureScrollEnd || |
| 498 gesture->type == WebInputEvent::GestureFlingCancel) { | 498 gesture->type == WebInputEvent::GestureFlingCancel) { |
| 499 content_input_manager_->ProcessUpdatedGesture(*gesture.get()); | 499 content_input_manager_->ProcessUpdatedGesture(*gesture.get()); |
| 500 } | 500 } |
| 501 | 501 |
| 502 if (gesture->type == WebInputEvent::GestureScrollEnd) { | 502 if (gesture->type == WebInputEvent::GestureScrollEnd) { |
| 503 CHECK(gesture_list.size() == 2); | 503 CHECK(gesture_list.size() == 2); |
| 504 std::unique_ptr<WebGestureEvent> fling_gesture = | 504 std::unique_ptr<WebGestureEvent> followup_gesture = |
| 505 std::move(gesture_list.back()); | 505 std::move(gesture_list.back()); |
| 506 content_input_manager_->ProcessUpdatedGesture(*fling_gesture.get()); | 506 if (followup_gesture->type == WebInputEvent::GestureTapDown) { |
| 507 followup_gesture->data.tapDown.width = pixel_x; |
| 508 followup_gesture->data.tapDown.height = pixel_y; |
| 509 if (input_target != nullptr) |
| 510 input_target->ProcessUpdatedGesture(*followup_gesture.get()); |
| 511 } else if (followup_gesture->type == WebInputEvent::GestureFlingStart) { |
| 512 content_input_manager_->ProcessUpdatedGesture(*followup_gesture.get()); |
| 513 } |
| 507 } | 514 } |
| 508 | 515 |
| 509 WebInputEvent::Type original_type = gesture->type; | 516 WebInputEvent::Type original_type = gesture->type; |
| 510 | 517 |
| 511 bool new_target = input_target != current_input_target_; | 518 bool new_target = input_target != current_input_target_; |
| 512 if (new_target && current_input_target_ != nullptr) { | 519 if (new_target && current_input_target_ != nullptr) { |
| 513 // Send a move event indicating that the pointer moved off of an element. | 520 // Send a move event indicating that the pointer moved off of an element. |
| 514 blink::WebMouseEvent mouse_event = MakeMouseEvent( | 521 blink::WebMouseEvent mouse_event = MakeMouseEvent( |
| 515 WebInputEvent::MouseLeave, gesture->timeStampSeconds, 0, 0); | 522 WebInputEvent::MouseLeave, gesture->timeStampSeconds, 0, 0); |
| 516 current_input_target_->ProcessUpdatedGesture(mouse_event); | 523 current_input_target_->ProcessUpdatedGesture(mouse_event); |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1047 const JavaParamRef<jobject>& ui_web_contents, | 1054 const JavaParamRef<jobject>& ui_web_contents, |
| 1048 jlong ui_window_android) { | 1055 jlong ui_window_android) { |
| 1049 return reinterpret_cast<intptr_t>(new VrShell( | 1056 return reinterpret_cast<intptr_t>(new VrShell( |
| 1050 env, obj, content::WebContents::FromJavaWebContents(content_web_contents), | 1057 env, obj, content::WebContents::FromJavaWebContents(content_web_contents), |
| 1051 reinterpret_cast<ui::WindowAndroid*>(content_window_android), | 1058 reinterpret_cast<ui::WindowAndroid*>(content_window_android), |
| 1052 content::WebContents::FromJavaWebContents(ui_web_contents), | 1059 content::WebContents::FromJavaWebContents(ui_web_contents), |
| 1053 reinterpret_cast<ui::WindowAndroid*>(ui_window_android))); | 1060 reinterpret_cast<ui::WindowAndroid*>(ui_window_android))); |
| 1054 } | 1061 } |
| 1055 | 1062 |
| 1056 } // namespace vr_shell | 1063 } // namespace vr_shell |
| OLD | NEW |