OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/renderer/input/input_handler_proxy.h" | 5 #include "content/renderer/input/input_handler_proxy.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
12 #include "content/common/input/did_overscroll_params.h" | 12 #include "content/common/input/did_overscroll_params.h" |
13 #include "content/common/input/web_input_event_traits.h" | 13 #include "content/common/input/web_input_event_traits.h" |
14 #include "content/public/common/content_switches.h" | 14 #include "content/public/common/content_switches.h" |
15 #include "content/renderer/input/input_handler_proxy_client.h" | 15 #include "content/renderer/input/input_handler_proxy_client.h" |
| 16 #include "content/renderer/input/input_scroll_elasticity_controller.h" |
16 #include "third_party/WebKit/public/platform/Platform.h" | 17 #include "third_party/WebKit/public/platform/Platform.h" |
17 #include "third_party/WebKit/public/web/WebInputEvent.h" | 18 #include "third_party/WebKit/public/web/WebInputEvent.h" |
18 #include "ui/events/latency_info.h" | 19 #include "ui/events/latency_info.h" |
19 #include "ui/gfx/frame_time.h" | 20 #include "ui/gfx/frame_time.h" |
20 #include "ui/gfx/geometry/point_conversions.h" | 21 #include "ui/gfx/geometry/point_conversions.h" |
21 | 22 |
22 using blink::WebFloatPoint; | 23 using blink::WebFloatPoint; |
23 using blink::WebFloatSize; | 24 using blink::WebFloatSize; |
24 using blink::WebGestureEvent; | 25 using blink::WebGestureEvent; |
25 using blink::WebInputEvent; | 26 using blink::WebInputEvent; |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 gesture_scroll_on_impl_thread_(false), | 155 gesture_scroll_on_impl_thread_(false), |
155 gesture_pinch_on_impl_thread_(false), | 156 gesture_pinch_on_impl_thread_(false), |
156 fling_may_be_active_on_main_thread_(false), | 157 fling_may_be_active_on_main_thread_(false), |
157 disallow_horizontal_fling_scroll_(false), | 158 disallow_horizontal_fling_scroll_(false), |
158 disallow_vertical_fling_scroll_(false), | 159 disallow_vertical_fling_scroll_(false), |
159 has_fling_animation_started_(false) { | 160 has_fling_animation_started_(false) { |
160 DCHECK(client); | 161 DCHECK(client); |
161 input_handler_->BindToClient(this); | 162 input_handler_->BindToClient(this); |
162 smooth_scroll_enabled_ = CommandLine::ForCurrentProcess()->HasSwitch( | 163 smooth_scroll_enabled_ = CommandLine::ForCurrentProcess()->HasSwitch( |
163 switches::kEnableSmoothScrolling); | 164 switches::kEnableSmoothScrolling); |
| 165 |
| 166 #if defined(OS_MACOSX) |
| 167 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 168 switches::kEnableThreadedEventHandlingMac)) { |
| 169 cc::ScrollElasticityControllerClient* scroll_elasticity_client = |
| 170 input_handler->GetScrollElasticityControllerClient(); |
| 171 scroll_elasticity_controller_.reset(new InputScrollElasticityController( |
| 172 scroll_elasticity_client)); |
| 173 scroll_elasticity_client->BindToController( |
| 174 scroll_elasticity_controller_.get()); |
| 175 } |
| 176 #endif |
164 } | 177 } |
165 | 178 |
166 InputHandlerProxy::~InputHandlerProxy() {} | 179 InputHandlerProxy::~InputHandlerProxy() {} |
167 | 180 |
168 void InputHandlerProxy::WillShutdown() { | 181 void InputHandlerProxy::WillShutdown() { |
169 input_handler_ = NULL; | 182 input_handler_ = NULL; |
170 client_->WillShutdown(); | 183 client_->WillShutdown(); |
171 } | 184 } |
172 | 185 |
173 InputHandlerProxy::EventDisposition | 186 InputHandlerProxy::EventDisposition |
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 // trigger a scroll, e.g., with a trivial time delta between fling updates. | 824 // trigger a scroll, e.g., with a trivial time delta between fling updates. |
812 // Return true in this case to prevent early fling termination. | 825 // Return true in this case to prevent early fling termination. |
813 if (std::abs(clipped_increment.width) < kScrollEpsilon && | 826 if (std::abs(clipped_increment.width) < kScrollEpsilon && |
814 std::abs(clipped_increment.height) < kScrollEpsilon) | 827 std::abs(clipped_increment.height) < kScrollEpsilon) |
815 return true; | 828 return true; |
816 | 829 |
817 return did_scroll; | 830 return did_scroll; |
818 } | 831 } |
819 | 832 |
820 } // namespace content | 833 } // namespace content |
OLD | NEW |