OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/browser/renderer_host/input/touch_selection_controller.h" | 5 #include "content/browser/renderer_host/input/touch_selection_controller.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "third_party/WebKit/public/web/WebInputEvent.h" | 9 #include "third_party/WebKit/public/web/WebInputEvent.h" |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 case cc::SELECTION_BOUND_EMPTY: | 22 case cc::SELECTION_BOUND_EMPTY: |
23 return TOUCH_HANDLE_ORIENTATION_UNDEFINED; | 23 return TOUCH_HANDLE_ORIENTATION_UNDEFINED; |
24 } | 24 } |
25 NOTREACHED() << "Invalid selection bound type: " << type; | 25 NOTREACHED() << "Invalid selection bound type: " << type; |
26 return TOUCH_HANDLE_ORIENTATION_UNDEFINED; | 26 return TOUCH_HANDLE_ORIENTATION_UNDEFINED; |
27 } | 27 } |
28 | 28 |
29 } // namespace | 29 } // namespace |
30 | 30 |
31 TouchSelectionController::TouchSelectionController( | 31 TouchSelectionController::TouchSelectionController( |
32 TouchSelectionControllerClient* client) | 32 TouchSelectionControllerClient* client, |
| 33 base::TimeDelta tap_timeout, |
| 34 float tap_slop) |
33 : client_(client), | 35 : client_(client), |
| 36 tap_timeout_(tap_timeout), |
| 37 tap_slop_(tap_slop), |
34 response_pending_input_event_(INPUT_EVENT_TYPE_NONE), | 38 response_pending_input_event_(INPUT_EVENT_TYPE_NONE), |
35 start_orientation_(TOUCH_HANDLE_ORIENTATION_UNDEFINED), | 39 start_orientation_(TOUCH_HANDLE_ORIENTATION_UNDEFINED), |
36 end_orientation_(TOUCH_HANDLE_ORIENTATION_UNDEFINED), | 40 end_orientation_(TOUCH_HANDLE_ORIENTATION_UNDEFINED), |
37 is_insertion_active_(false), | 41 is_insertion_active_(false), |
38 activate_insertion_automatically_(false), | 42 activate_insertion_automatically_(false), |
39 is_selection_active_(false), | 43 is_selection_active_(false), |
40 activate_selection_automatically_(false), | 44 activate_selection_automatically_(false), |
41 selection_empty_(false), | 45 selection_empty_(false), |
42 selection_editable_(false), | 46 selection_editable_(false), |
43 temporarily_hidden_(false) { | 47 temporarily_hidden_(false) { |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 } | 245 } |
242 | 246 |
243 void TouchSelectionController::SetNeedsAnimate() { | 247 void TouchSelectionController::SetNeedsAnimate() { |
244 client_->SetNeedsAnimate(); | 248 client_->SetNeedsAnimate(); |
245 } | 249 } |
246 | 250 |
247 scoped_ptr<TouchHandleDrawable> TouchSelectionController::CreateDrawable() { | 251 scoped_ptr<TouchHandleDrawable> TouchSelectionController::CreateDrawable() { |
248 return client_->CreateDrawable(); | 252 return client_->CreateDrawable(); |
249 } | 253 } |
250 | 254 |
| 255 base::TimeDelta TouchSelectionController::GetTapTimeout() const { |
| 256 return tap_timeout_; |
| 257 } |
| 258 |
| 259 float TouchSelectionController::GetTapSlop() const { |
| 260 return tap_slop_; |
| 261 } |
| 262 |
251 void TouchSelectionController::ShowInsertionHandleAutomatically() { | 263 void TouchSelectionController::ShowInsertionHandleAutomatically() { |
252 if (activate_insertion_automatically_) | 264 if (activate_insertion_automatically_) |
253 return; | 265 return; |
254 activate_insertion_automatically_ = true; | 266 activate_insertion_automatically_ = true; |
255 ResetCachedValuesIfInactive(); | 267 ResetCachedValuesIfInactive(); |
256 } | 268 } |
257 | 269 |
258 void TouchSelectionController::ShowSelectionHandlesAutomatically() { | 270 void TouchSelectionController::ShowSelectionHandlesAutomatically() { |
259 if (activate_selection_automatically_) | 271 if (activate_selection_automatically_) |
260 return; | 272 return; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 } | 408 } |
397 | 409 |
398 TouchHandle::AnimationStyle TouchSelectionController::GetAnimationStyle( | 410 TouchHandle::AnimationStyle TouchSelectionController::GetAnimationStyle( |
399 bool was_active) const { | 411 bool was_active) const { |
400 return was_active && client_->SupportsAnimation() | 412 return was_active && client_->SupportsAnimation() |
401 ? TouchHandle::ANIMATION_SMOOTH | 413 ? TouchHandle::ANIMATION_SMOOTH |
402 : TouchHandle::ANIMATION_NONE; | 414 : TouchHandle::ANIMATION_NONE; |
403 } | 415 } |
404 | 416 |
405 } // namespace content | 417 } // namespace content |
OLD | NEW |