| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "blimp/client/feature/compositor/blimp_input_handler_wrapper.h" | 5 #include "blimp/client/core/input/blimp_input_handler_wrapper.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "blimp/client/feature/compositor/blimp_input_manager.h" | 10 #include "base/synchronization/waitable_event.h" |
| 11 #include "base/threading/thread_checker.h" |
| 12 #include "blimp/client/core/input/blimp_input_manager.h" |
| 13 #include "ui/events/blink/input_handler_proxy.h" |
| 11 #include "ui/events/gestures/blink/web_gesture_curve_impl.h" | 14 #include "ui/events/gestures/blink/web_gesture_curve_impl.h" |
| 12 | 15 |
| 13 namespace blimp { | 16 namespace blimp { |
| 14 namespace client { | 17 namespace client { |
| 15 | 18 |
| 16 BlimpInputHandlerWrapper::BlimpInputHandlerWrapper( | 19 BlimpInputHandlerWrapper::BlimpInputHandlerWrapper( |
| 17 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 20 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 18 const base::WeakPtr<BlimpInputManager> input_manager_weak_ptr, | 21 const base::WeakPtr<BlimpInputManager> input_manager_weak_ptr, |
| 19 cc::InputHandler* input_handler) | 22 cc::InputHandler* input_handler) |
| 20 : main_task_runner_(main_task_runner), | 23 : main_task_runner_(main_task_runner), |
| 21 input_manager_weak_ptr_(input_manager_weak_ptr) { | 24 input_manager_weak_ptr_(input_manager_weak_ptr) { |
| 22 DCHECK(compositor_thread_checker_.CalledOnValidThread()); | 25 DCHECK(compositor_thread_checker_.CalledOnValidThread()); |
| 23 DCHECK(input_handler); | 26 DCHECK(input_handler); |
| 24 input_handler_proxy_.reset( | 27 input_handler_proxy_.reset(new ui::InputHandlerProxy(input_handler, this)); |
| 25 new ui::InputHandlerProxy(input_handler, this)); | |
| 26 } | 28 } |
| 27 | 29 |
| 28 BlimpInputHandlerWrapper::~BlimpInputHandlerWrapper() { | 30 BlimpInputHandlerWrapper::~BlimpInputHandlerWrapper() { |
| 29 DCHECK(compositor_thread_checker_.CalledOnValidThread()); | 31 DCHECK(compositor_thread_checker_.CalledOnValidThread()); |
| 30 | 32 |
| 31 // The input handler proxy must have been shutdown by the cc::InputHandler | 33 // The input handler proxy must have been shutdown by the cc::InputHandler |
| 32 // before the InputHandlerWrapper is destroyed. | 34 // before the InputHandlerWrapper is destroyed. |
| 33 DCHECK(!input_handler_proxy_); | 35 DCHECK(!input_handler_proxy_); |
| 34 } | 36 } |
| 35 | 37 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 65 void BlimpInputHandlerWrapper::WillShutdown() { | 67 void BlimpInputHandlerWrapper::WillShutdown() { |
| 66 DCHECK(compositor_thread_checker_.CalledOnValidThread()); | 68 DCHECK(compositor_thread_checker_.CalledOnValidThread()); |
| 67 | 69 |
| 68 input_handler_proxy_.reset(); | 70 input_handler_proxy_.reset(); |
| 69 } | 71 } |
| 70 | 72 |
| 71 void BlimpInputHandlerWrapper::TransferActiveWheelFlingAnimation( | 73 void BlimpInputHandlerWrapper::TransferActiveWheelFlingAnimation( |
| 72 const blink::WebActiveWheelFlingParameters& params) { | 74 const blink::WebActiveWheelFlingParameters& params) { |
| 73 DCHECK(compositor_thread_checker_.CalledOnValidThread()); | 75 DCHECK(compositor_thread_checker_.CalledOnValidThread()); |
| 74 | 76 |
| 75 NOTIMPLEMENTED() << | 77 NOTIMPLEMENTED() |
| 76 "Transferring Fling Animations to the engine is not supported"; | 78 << "Transferring Fling Animations to the engine is not supported"; |
| 77 } | 79 } |
| 78 | 80 |
| 79 blink::WebGestureCurve* BlimpInputHandlerWrapper::CreateFlingAnimationCurve( | 81 blink::WebGestureCurve* BlimpInputHandlerWrapper::CreateFlingAnimationCurve( |
| 80 blink::WebGestureDevice device_source, | 82 blink::WebGestureDevice device_source, |
| 81 const blink::WebFloatPoint& velocity, | 83 const blink::WebFloatPoint& velocity, |
| 82 const blink::WebSize& cumulative_scroll) { | 84 const blink::WebSize& cumulative_scroll) { |
| 83 DCHECK(compositor_thread_checker_.CalledOnValidThread()); | 85 DCHECK(compositor_thread_checker_.CalledOnValidThread()); |
| 84 | 86 |
| 85 return ui::WebGestureCurveImpl::CreateFromDefaultPlatformCurve( | 87 return ui::WebGestureCurveImpl::CreateFromDefaultPlatformCurve( |
| 86 gfx::Vector2dF(velocity.x, velocity.y), | 88 gfx::Vector2dF(velocity.x, velocity.y), |
| 87 gfx::Vector2dF(cumulative_scroll.width, | 89 gfx::Vector2dF(cumulative_scroll.width, cumulative_scroll.height), |
| 88 cumulative_scroll.height), | 90 false /* on_main_thread */) |
| 89 false /* on_main_thread */).release(); | 91 .release(); |
| 90 } | 92 } |
| 91 | 93 |
| 92 void BlimpInputHandlerWrapper::DidOverscroll( | 94 void BlimpInputHandlerWrapper::DidOverscroll( |
| 93 const gfx::Vector2dF& accumulated_overscroll, | 95 const gfx::Vector2dF& accumulated_overscroll, |
| 94 const gfx::Vector2dF& latest_overscroll_delta, | 96 const gfx::Vector2dF& latest_overscroll_delta, |
| 95 const gfx::Vector2dF& current_fling_velocity, | 97 const gfx::Vector2dF& current_fling_velocity, |
| 96 const gfx::PointF& causal_event_viewport_point) { | 98 const gfx::PointF& causal_event_viewport_point) { |
| 97 DCHECK(compositor_thread_checker_.CalledOnValidThread()); | 99 DCHECK(compositor_thread_checker_.CalledOnValidThread()); |
| 98 } | 100 } |
| 99 | 101 |
| 100 void BlimpInputHandlerWrapper::DidStartFlinging() { | 102 void BlimpInputHandlerWrapper::DidStartFlinging() { |
| 101 DCHECK(compositor_thread_checker_.CalledOnValidThread()); | 103 DCHECK(compositor_thread_checker_.CalledOnValidThread()); |
| 102 } | 104 } |
| 103 | 105 |
| 104 void BlimpInputHandlerWrapper::DidStopFlinging() { | 106 void BlimpInputHandlerWrapper::DidStopFlinging() { |
| 105 DCHECK(compositor_thread_checker_.CalledOnValidThread()); | 107 DCHECK(compositor_thread_checker_.CalledOnValidThread()); |
| 106 } | 108 } |
| 107 | 109 |
| 108 void BlimpInputHandlerWrapper::DidAnimateForInput() { | 110 void BlimpInputHandlerWrapper::DidAnimateForInput() { |
| 109 DCHECK(compositor_thread_checker_.CalledOnValidThread()); | 111 DCHECK(compositor_thread_checker_.CalledOnValidThread()); |
| 110 } | 112 } |
| 111 | 113 |
| 112 } // namespace client | 114 } // namespace client |
| 113 } // namespace blimp | 115 } // namespace blimp |
| OLD | NEW |