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

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

Issue 465543003: Modified state flow for touch explore released 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
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/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "ui/aura/client/cursor_client.h" 9 #include "ui/aura/client/cursor_client.h"
10 #include "ui/aura/window.h" 10 #include "ui/aura/window.h"
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 if (current_touch_ids_.size() > 1) { 232 if (current_touch_ids_.size() > 1) {
233 state_ = WAIT_FOR_ONE_FINGER; 233 state_ = WAIT_FOR_ONE_FINGER;
234 return ui::EVENT_REWRITE_DISCARD; 234 return ui::EVENT_REWRITE_DISCARD;
235 } 235 }
236 if (type == ui::ET_TOUCH_PRESSED) { 236 if (type == ui::ET_TOUCH_PRESSED) {
237 // If there is no touch exploration yet, we can't send a click, so discard. 237 // If there is no touch exploration yet, we can't send a click, so discard.
238 if (!last_touch_exploration_) { 238 if (!last_touch_exploration_) {
239 tap_timer_.Stop(); 239 tap_timer_.Stop();
240 return ui::EVENT_REWRITE_DISCARD; 240 return ui::EVENT_REWRITE_DISCARD;
241 } 241 }
242 // This is the second tap in a double-tap (or double tap-hold). 242 if (state_ == SINGLE_TAP_RELEASED) {
243 // We set the tap timer. If it fires before the user lifts their finger, 243 // This is the second tap in a double-tap (or double tap-hold).
244 // one-finger passthrough begins. Otherwise, there is a touch press and 244 // We set the tap timer. If it fires before the user lifts their finger,
245 // release at the location of the last touch exploration. 245 // one-finger passthrough begins. Otherwise, there is a touch press and
246 state_ = DOUBLE_TAP_PENDING; 246 // release at the location of the last touch exploration.
247 VLOG_STATE(); 247 state_ = DOUBLE_TAP_PENDING;
248 StartTapTimer(); 248 VLOG_STATE();
249 // This will update as the finger moves before a possible passthrough, and 249 StartTapTimer();
250 // will determine the offset. 250 // This will update as the finger moves before a possible passthrough, and
251 last_unused_finger_event_.reset(new ui::TouchEvent(event)); 251 // will determine the offset.
252 return ui::EVENT_REWRITE_DISCARD; 252 last_unused_finger_event_.reset(new ui::TouchEvent(event));
253 return ui::EVENT_REWRITE_DISCARD;
254 } else if (state_ == TOUCH_EXPLORE_RELEASED) {
255 // This is the initial "press" (location, time, and touch id) of a single
256 // tap click.
257 initial_press_.reset(new ui::TouchEvent(event));
258 rewritten_event->reset(
259 new ui::TouchEvent(ui::ET_TOUCH_PRESSED,
260 last_touch_exploration_->location(),
261 initial_press_->touch_id(),
262 event.time_stamp()));
263 (*rewritten_event)->set_flags(event.flags());
264 state_ = TOUCH_RELEASE_PENDING;
265 VLOG_STATE();
266 return ui::EVENT_REWRITE_REWRITTEN;
267 }
253 } else if (type == ui::ET_TOUCH_RELEASED && !last_touch_exploration_) { 268 } else if (type == ui::ET_TOUCH_RELEASED && !last_touch_exploration_) {
254 // If the previous press was discarded, we need to also handle its 269 // If the previous press was discarded, we need to also handle its
255 // release. 270 // release.
256 if (current_touch_ids_.size() == 0) { 271 if (current_touch_ids_.size() == 0) {
257 ResetToNoFingersDown(); 272 ResetToNoFingersDown();
258 } 273 }
259 return ui::EVENT_REWRITE_DISCARD; 274 return ui::EVENT_REWRITE_DISCARD;
260 } else if (type == ui::ET_TOUCH_MOVED) { 275 } else if (type == ui::ET_TOUCH_MOVED) {
261 return ui::EVENT_REWRITE_DISCARD; 276 return ui::EVENT_REWRITE_DISCARD;
262 } 277 }
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 return "SLIDE_GESTURE"; 888 return "SLIDE_GESTURE";
874 case ONE_FINGER_PASSTHROUGH: 889 case ONE_FINGER_PASSTHROUGH:
875 return "ONE_FINGER_PASSTHROUGH"; 890 return "ONE_FINGER_PASSTHROUGH";
876 case WAIT_FOR_ONE_FINGER: 891 case WAIT_FOR_ONE_FINGER:
877 return "WAIT_FOR_ONE_FINGER"; 892 return "WAIT_FOR_ONE_FINGER";
878 } 893 }
879 return "Not a state"; 894 return "Not a state";
880 } 895 }
881 896
882 } // namespace ui 897 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698