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

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

Issue 2733603003: Tapping/longpressing should result in INSERTION_HANDLE_SHOWN (Closed)
Patch Set: removed InsertionNotResetByRepeatedTapOrPress Created 3 years, 9 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 #include "base/metrics/user_metrics.h" 10 #include "base/metrics/user_metrics.h"
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 } 456 }
457 457
458 bool TouchSelectionController::ActivateInsertionIfNecessary() { 458 bool TouchSelectionController::ActivateInsertionIfNecessary() {
459 DCHECK_NE(SELECTION_ACTIVE, active_status_); 459 DCHECK_NE(SELECTION_ACTIVE, active_status_);
460 460
461 if (!insertion_handle_) { 461 if (!insertion_handle_) {
462 insertion_handle_.reset( 462 insertion_handle_.reset(
463 new TouchHandle(this, TouchHandleOrientation::CENTER, viewport_rect_)); 463 new TouchHandle(this, TouchHandleOrientation::CENTER, viewport_rect_));
464 } 464 }
465 465
466 if (active_status_ == INACTIVE) { 466 if (active_status_ == INACTIVE || response_pending_input_event_ == TAP ||
467 response_pending_input_event_ == LONG_PRESS) {
467 active_status_ = INSERTION_ACTIVE; 468 active_status_ = INSERTION_ACTIVE;
468 insertion_handle_->SetEnabled(true); 469 insertion_handle_->SetEnabled(true);
469 insertion_handle_->SetViewportRect(viewport_rect_); 470 insertion_handle_->SetViewportRect(viewport_rect_);
471 response_pending_input_event_ = INPUT_EVENT_TYPE_NONE;
470 return true; 472 return true;
471 } 473 }
472 return false; 474 return false;
473 } 475 }
474 476
475 void TouchSelectionController::DeactivateInsertion() { 477 void TouchSelectionController::DeactivateInsertion() {
476 if (active_status_ != INSERTION_ACTIVE) 478 if (active_status_ != INSERTION_ACTIVE)
477 return; 479 return;
478 DCHECK(insertion_handle_); 480 DCHECK(insertion_handle_);
479 active_status_ = INACTIVE; 481 active_status_ = INACTIVE;
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 base::TimeDelta duration = base::TimeTicks::Now() - selection_start_time_; 599 base::TimeDelta duration = base::TimeTicks::Now() - selection_start_time_;
598 UMA_HISTOGRAM_CUSTOM_TIMES("Event.TouchSelection.WasDraggedDuration", 600 UMA_HISTOGRAM_CUSTOM_TIMES("Event.TouchSelection.WasDraggedDuration",
599 duration, 601 duration,
600 base::TimeDelta::FromMilliseconds(500), 602 base::TimeDelta::FromMilliseconds(500),
601 base::TimeDelta::FromSeconds(60), 603 base::TimeDelta::FromSeconds(60),
602 60); 604 60);
603 } 605 }
604 } 606 }
605 607
606 } // namespace ui 608 } // namespace ui
OLDNEW
« no previous file with comments | « ui/touch_selection/touch_selection_controller.h ('k') | ui/touch_selection/touch_selection_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698