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

Side by Side Diff: ui/touch_selection/touch_selection_controller_aura.cc

Issue 903143003: wip: Touch Text Selection Prototypes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@selection_granularity_on_unified
Patch Set: Created 5 years, 10 months 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
« no previous file with comments | « ui/touch_selection/touch_selection_controller_aura.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ui/touch_selection/touch_selection_controller_aura.h" 5 #include "ui/touch_selection/touch_selection_controller_aura.h"
6 6
7 #include "ui/aura/client/cursor_client.h" 7 #include "ui/aura/client/cursor_client.h"
8 #include "ui/aura/env.h" 8 #include "ui/aura/env.h"
9 #include "ui/aura/window.h" 9 #include "ui/aura/window.h"
10 #include "ui/events/event.h" 10 #include "ui/events/event.h"
11 #include "ui/events/gesture_detection/gesture_configuration.h" 11 #include "ui/events/gesture_detection/gesture_configuration.h"
12 #include "ui/events/gestures/motion_event_aura.h" 12 #include "ui/events/gestures/motion_event_aura.h"
13 #include "ui/touch_selection/touch_handle_drawable_aura.h" 13 #include "ui/touch_selection/touch_handle_drawable_aura.h"
14 14
15 15
16 namespace ui { 16 namespace ui {
17 17
18 TouchSelectionControllerAura::TouchSelectionControllerAura( 18 TouchSelectionControllerAura::TouchSelectionControllerAura(
19 TouchSelectionControllerAuraClient* client) 19 TouchSelectionControllerAuraClient* client,
20 TextSelectionGranularityStrategy selection_granularity_strategy)
20 : client_(client), 21 : client_(client),
21 motion_event_(new MotionEventAura), 22 motion_event_(new MotionEventAura),
22 scroll_in_progress_(false), 23 scroll_in_progress_(false),
23 overscroll_in_progress_(false), 24 overscroll_in_progress_(false),
24 handle_drag_in_progress_(false) { 25 handle_drag_in_progress_(false) {
25 int tap_timeout_ms = 26 int tap_timeout_ms =
26 GestureConfiguration::GetInstance()->show_press_delay_in_ms(); 27 GestureConfiguration::GetInstance()->show_press_delay_in_ms();
27 int touch_slop = 28 int touch_slop =
28 GestureConfiguration::GetInstance()->max_touch_move_in_pixels_for_click(); 29 GestureConfiguration::GetInstance()->max_touch_move_in_pixels_for_click();
29 controller_.reset(new TouchSelectionController( 30 controller_.reset(new TouchSelectionController(
30 this, 31 this,
31 base::TimeDelta::FromMilliseconds(tap_timeout_ms), 32 base::TimeDelta::FromMilliseconds(tap_timeout_ms),
32 touch_slop, 33 touch_slop,
33 true)); 34 true,
35 selection_granularity_strategy));
34 } 36 }
35 37
36 TouchSelectionControllerAura::~TouchSelectionControllerAura() { 38 TouchSelectionControllerAura::~TouchSelectionControllerAura() {
37 } 39 }
38 40
41 void TouchSelectionControllerAura::SetVelocityStrategyParameters(
42 int halfDecayMs, int threshold) {
43 controller_->SetVelocityStrategyParameters(halfDecayMs, threshold);
44 }
45
39 void TouchSelectionControllerAura::OnSelectionEditable(bool editable) { 46 void TouchSelectionControllerAura::OnSelectionEditable(bool editable) {
40 controller_->OnSelectionEditable(editable); 47 controller_->OnSelectionEditable(editable);
41 UpdateQuickMenu(); 48 UpdateQuickMenu();
42 } 49 }
43 50
44 void TouchSelectionControllerAura::OnSelectionEmpty(bool empty) { 51 void TouchSelectionControllerAura::OnSelectionEmpty(bool empty) {
45 controller_->OnSelectionEmpty(empty); 52 controller_->OnSelectionEmpty(empty);
46 UpdateQuickMenu(); 53 UpdateQuickMenu();
47 } 54 }
48 55
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 void TouchSelectionControllerAura::OnScrollEvent(ScrollEvent* event) { 313 void TouchSelectionControllerAura::OnScrollEvent(ScrollEvent* event) {
307 LOG(ERROR) << "ScrollEvent: " << event->name(); 314 LOG(ERROR) << "ScrollEvent: " << event->name();
308 315
309 DCHECK(controller_->is_insertion_active() || 316 DCHECK(controller_->is_insertion_active() ||
310 controller_->is_selection_active()); 317 controller_->is_selection_active());
311 318
312 HideAndDisallowShowingAutomatically(); 319 HideAndDisallowShowingAutomatically();
313 } 320 }
314 321
315 } // namespace ui 322 } // namespace ui
OLDNEW
« no previous file with comments | « ui/touch_selection/touch_selection_controller_aura.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698