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

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

Issue 1239583003: Update touch selection notification names, add ESTABLISHED. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add new SelectionEventTypes for bounds changing instead of reusing an insertion event. Created 5 years, 5 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
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.h" 5 #include "ui/touch_selection/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 "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 10
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 73
74 TouchSelectionController::~TouchSelectionController() { 74 TouchSelectionController::~TouchSelectionController() {
75 } 75 }
76 76
77 void TouchSelectionController::OnSelectionBoundsChanged( 77 void TouchSelectionController::OnSelectionBoundsChanged(
78 const SelectionBound& start, 78 const SelectionBound& start,
79 const SelectionBound& end) { 79 const SelectionBound& end) {
80 if (!force_next_update_ && start == start_ && end_ == end) 80 if (!force_next_update_ && start == start_ && end_ == end)
81 return; 81 return;
82 82
83 // Notify if selection bounds have just been established or dissolved.
84 if (start.type() != SelectionBound::EMPTY &&
85 start_.type() == SelectionBound::EMPTY) {
86 client_->OnSelectionEvent(BOUNDS_ESTABLISHED);
87 } else if (start.type() == SelectionBound::EMPTY &&
88 start_.type() != SelectionBound::EMPTY) {
89 client_->OnSelectionEvent(BOUNDS_DISSOLVED);
90 }
91
83 start_ = start; 92 start_ = start;
84 end_ = end; 93 end_ = end;
85 start_orientation_ = ToTouchHandleOrientation(start_.type()); 94 start_orientation_ = ToTouchHandleOrientation(start_.type());
86 end_orientation_ = ToTouchHandleOrientation(end_.type()); 95 end_orientation_ = ToTouchHandleOrientation(end_.type());
87 force_next_update_ = false; 96 force_next_update_ = false;
88 97
89 if (!activate_selection_automatically_ && 98 if (!activate_selection_automatically_ &&
90 !activate_insertion_automatically_) { 99 !activate_insertion_automatically_) {
91 DCHECK_EQ(INACTIVE, active_status_); 100 DCHECK_EQ(INACTIVE, active_status_);
92 DCHECK_EQ(INPUT_EVENT_TYPE_NONE, response_pending_input_event_); 101 DCHECK_EQ(INPUT_EVENT_TYPE_NONE, response_pending_input_event_);
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 base::TimeDelta duration = base::TimeTicks::Now() - selection_start_time_; 597 base::TimeDelta duration = base::TimeTicks::Now() - selection_start_time_;
589 UMA_HISTOGRAM_CUSTOM_TIMES("Event.TouchSelection.WasDraggedDuration", 598 UMA_HISTOGRAM_CUSTOM_TIMES("Event.TouchSelection.WasDraggedDuration",
590 duration, 599 duration,
591 base::TimeDelta::FromMilliseconds(500), 600 base::TimeDelta::FromMilliseconds(500),
592 base::TimeDelta::FromSeconds(60), 601 base::TimeDelta::FromSeconds(60),
593 60); 602 60);
594 } 603 }
595 } 604 }
596 605
597 } // namespace ui 606 } // namespace ui
OLDNEW
« ui/touch_selection/selection_event_type.h ('K') | « ui/touch_selection/selection_event_type.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698