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

Side by Side Diff: ui/chromeos/touch_exploration_controller.cc

Issue 419923002: Fixed NOTREACHED() bug in touch_exploration_controller. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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 | « no previous file | ui/chromeos/touch_exploration_controller_unittest.cc » ('j') | 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/chromeos/touch_exploration_controller.h" 5 #include "ui/chromeos/touch_exploration_controller.h"
6 6
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "ui/aura/client/cursor_client.h" 8 #include "ui/aura/client/cursor_client.h"
9 #include "ui/aura/window.h" 9 #include "ui/aura/window.h"
10 #include "ui/aura/window_event_dispatcher.h" 10 #include "ui/aura/window_event_dispatcher.h"
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 TouchExplorationController::InSingleTapOrTouchExploreReleased( 236 TouchExplorationController::InSingleTapOrTouchExploreReleased(
237 const ui::TouchEvent& event, 237 const ui::TouchEvent& event,
238 scoped_ptr<ui::Event>* rewritten_event) { 238 scoped_ptr<ui::Event>* rewritten_event) {
239 const ui::EventType type = event.type(); 239 const ui::EventType type = event.type();
240 // If there is more than one finger down, then discard to wait until only one 240 // If there is more than one finger down, then discard to wait until only one
241 // finger is or no fingers are down. 241 // finger is or no fingers are down.
242 if (current_touch_ids_.size() > 1) { 242 if (current_touch_ids_.size() > 1) {
243 state_ = WAIT_FOR_RELEASE; 243 state_ = WAIT_FOR_RELEASE;
244 return ui::EVENT_REWRITE_DISCARD; 244 return ui::EVENT_REWRITE_DISCARD;
245 } 245 }
246 // If there is no touch exploration yet, discard. 246 if (type == ui::ET_TOUCH_PRESSED) {
247 if (!last_touch_exploration_ || type == ui::ET_TOUCH_RELEASED) { 247 // If there is no touch exploration yet, we can't send a click, so discard.
248 if (current_touch_ids_.size() == 0) { 248 if (!last_touch_exploration_) {
249 ResetToNoFingersDown(); 249 tap_timer_.Stop();
250 return ui::EVENT_REWRITE_DISCARD;
250 } 251 }
251 return ui::EVENT_REWRITE_DISCARD;
252 }
253
254 if (type == ui::ET_TOUCH_PRESSED) {
255 // This is the second tap in a double-tap (or double tap-hold). 252 // This is the second tap in a double-tap (or double tap-hold).
256 // Rewrite at location of last touch exploration. 253 // Rewrite at location of last touch exploration.
257 rewritten_event->reset( 254 rewritten_event->reset(
258 new ui::TouchEvent(ui::ET_TOUCH_PRESSED, 255 new ui::TouchEvent(ui::ET_TOUCH_PRESSED,
259 last_touch_exploration_->location(), 256 last_touch_exploration_->location(),
260 event.touch_id(), 257 event.touch_id(),
261 event.time_stamp())); 258 event.time_stamp()));
262 (*rewritten_event)->set_flags(event.flags()); 259 (*rewritten_event)->set_flags(event.flags());
263 state_ = DOUBLE_TAP_PRESSED; 260 state_ = DOUBLE_TAP_PRESSED;
264 VLOG_STATE(); 261 VLOG_STATE();
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 return "PASSTHROUGH"; 876 return "PASSTHROUGH";
880 case WAIT_FOR_RELEASE: 877 case WAIT_FOR_RELEASE:
881 return "WAIT_FOR_RELEASE"; 878 return "WAIT_FOR_RELEASE";
882 case SLIDE_GESTURE: 879 case SLIDE_GESTURE:
883 return "SLIDE_GESTURE"; 880 return "SLIDE_GESTURE";
884 } 881 }
885 return "Not a state"; 882 return "Not a state";
886 } 883 }
887 884
888 } // namespace ui 885 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/chromeos/touch_exploration_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698