Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(373)

Side by Side Diff: blimp/client/input/blimp_input_handler_wrapper.cc

Issue 1430623004: blimp: Add support for input handling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move all input handling on compositor thread to BlimpInputHandlerWrapper. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "blimp/client/input/blimp_input_handler_wrapper.h"
6
7 #include "base/bind.h"
8 #include "base/location.h"
9 #include "base/logging.h"
10 #include "blimp/client/input/blimp_input_manager.h"
11 #include "ui/events/gestures/blink/web_gesture_curve_impl.h"
12
13 namespace blimp {
14
15 BlimpInputHandlerWrapper::BlimpInputHandlerWrapper(
16 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
17 const base::WeakPtr<BlimpInputManager> input_manager_weak_ptr,
18 cc::InputHandler* input_handler)
19 : main_task_runner_(main_task_runner),
20 input_manager_weak_ptr_(input_manager_weak_ptr) {
21 DCHECK(compositor_thread_checker_.CalledOnValidThread());
22 DCHECK(input_handler);
23 input_handler_proxy_.reset(
24 new ui::InputHandlerProxy(input_handler, this));
25 }
26
27 void BlimpInputHandlerWrapper::HandleWebInputEvent(
28 const blink::WebInputEvent& input_event) {
29 DCHECK(compositor_thread_checker_.CalledOnValidThread());
30
31 // We might not have the input handler proxy anymore.
32 if (!input_handler_proxy_)
33 return;
34
35 ui::InputHandlerProxy::EventDisposition disposition =
36 input_handler_proxy_->HandleInputEvent(input_event);
37
38 bool consumed = disposition == ui::InputHandlerProxy::DID_NOT_HANDLE;
39
40 main_task_runner_->PostTask(
41 FROM_HERE,
42 base::Bind(&BlimpInputManager::DidHandleWebInputEvent,
43 input_manager_weak_ptr_, input_event, consumed));
44 }
45
46 void BlimpInputHandlerWrapper::WillShutdown() {
47 DCHECK(compositor_thread_checker_.CalledOnValidThread());
48
49 input_handler_proxy_.reset();
50 }
51
52 void BlimpInputHandlerWrapper::TransferActiveWheelFlingAnimation(
53 const blink::WebActiveWheelFlingParameters& params) {
54 DCHECK(compositor_thread_checker_.CalledOnValidThread());
55
56 NOTIMPLEMENTED() <<
57 "Transferring Fling Animations to the engine is not supported";
58 }
59
60 blink::WebGestureCurve* BlimpInputHandlerWrapper::CreateFlingAnimationCurve(
61 blink::WebGestureDevice device_source,
62 const blink::WebFloatPoint& velocity,
63 const blink::WebSize& cumulative_scroll) {
64 DCHECK(compositor_thread_checker_.CalledOnValidThread());
65
66 return ui::WebGestureCurveImpl::CreateFromDefaultPlatformCurve(
67 gfx::Vector2dF(velocity.x, velocity.y),
68 gfx::Vector2dF(cumulative_scroll.width,
69 cumulative_scroll.height),
70 false /* on_main_thread */).release();
71 }
72
73 void BlimpInputHandlerWrapper::DidOverscroll(
74 const gfx::Vector2dF& accumulated_overscroll,
75 const gfx::Vector2dF& latest_overscroll_delta,
76 const gfx::Vector2dF& current_fling_velocity,
77 const gfx::PointF& causal_event_viewport_point) {
78 DCHECK(compositor_thread_checker_.CalledOnValidThread());
79 }
80
81 void BlimpInputHandlerWrapper::DidStopFlinging() {
82 DCHECK(compositor_thread_checker_.CalledOnValidThread());
83 }
84
85 void BlimpInputHandlerWrapper::DidAnimateForInput() {
86 DCHECK(compositor_thread_checker_.CalledOnValidThread());
87 }
88
89 } // namespace blimp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698