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