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

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

Issue 1372253002: gfx: Make conversions from gfx::Point to PointF explicit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pointfconvert-gfx: . Created 5 years, 2 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 "base/time/default_tick_clock.h" 9 #include "base/time/default_tick_clock.h"
10 #include "ui/aura/client/cursor_client.h" 10 #include "ui/aura/client/cursor_client.h"
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 SET_STATE(NO_FINGERS_DOWN); 704 SET_STATE(NO_FINGERS_DOWN);
705 break; 705 break;
706 case TOUCH_EXPLORE_RELEASED: 706 case TOUCH_EXPLORE_RELEASED:
707 SET_STATE(NO_FINGERS_DOWN); 707 SET_STATE(NO_FINGERS_DOWN);
708 last_touch_exploration_.reset(new TouchEvent(*initial_press_)); 708 last_touch_exploration_.reset(new TouchEvent(*initial_press_));
709 return; 709 return;
710 case DOUBLE_TAP_PENDING: { 710 case DOUBLE_TAP_PENDING: {
711 SET_STATE(ONE_FINGER_PASSTHROUGH); 711 SET_STATE(ONE_FINGER_PASSTHROUGH);
712 passthrough_offset_ = last_unused_finger_event_->location() - 712 passthrough_offset_ = last_unused_finger_event_->location() -
713 last_touch_exploration_->location(); 713 last_touch_exploration_->location();
714 scoped_ptr<ui::TouchEvent> passthrough_press( 714 scoped_ptr<ui::TouchEvent> passthrough_press(new ui::TouchEvent(
715 new ui::TouchEvent(ui::ET_TOUCH_PRESSED, 715 ui::ET_TOUCH_PRESSED, last_touch_exploration_->location_f(),
716 last_touch_exploration_->location(), 716 last_unused_finger_event_->touch_id(), Now()));
717 last_unused_finger_event_->touch_id(),
718 Now()));
719 DispatchEvent(passthrough_press.get()); 717 DispatchEvent(passthrough_press.get());
720 return; 718 return;
721 } 719 }
722 case SINGLE_TAP_PRESSED: 720 case SINGLE_TAP_PRESSED:
723 if (passthrough_timer_.IsRunning()) 721 if (passthrough_timer_.IsRunning())
724 return; 722 return;
725 case GESTURE_IN_PROGRESS: 723 case GESTURE_IN_PROGRESS:
726 // If only one finger is down, go into touch exploration. 724 // If only one finger is down, go into touch exploration.
727 if (current_touch_ids_.size() == 1) { 725 if (current_touch_ids_.size() == 1) {
728 EnterTouchToMouseMode(); 726 EnterTouchToMouseMode();
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 base::Closure TouchExplorationController::BindKeyEventWithFlags( 956 base::Closure TouchExplorationController::BindKeyEventWithFlags(
959 const ui::KeyboardCode key, 957 const ui::KeyboardCode key,
960 int flags) { 958 int flags) {
961 return base::Bind(&TouchExplorationController::DispatchKeyWithFlags, 959 return base::Bind(&TouchExplorationController::DispatchKeyWithFlags,
962 base::Unretained(this), 960 base::Unretained(this),
963 key, 961 key,
964 flags); 962 flags);
965 } 963 }
966 964
967 scoped_ptr<ui::Event> TouchExplorationController::CreateMouseMoveEvent( 965 scoped_ptr<ui::Event> TouchExplorationController::CreateMouseMoveEvent(
968 const gfx::PointF& location, 966 const gfx::Point& location,
969 int flags) { 967 int flags) {
970 // The "synthesized" flag should be set on all events that don't have a 968 // The "synthesized" flag should be set on all events that don't have a
971 // backing native event. 969 // backing native event.
972 flags |= ui::EF_IS_SYNTHESIZED; 970 flags |= ui::EF_IS_SYNTHESIZED;
973 971
974 // This flag is used to identify mouse move events that were generated from 972 // This flag is used to identify mouse move events that were generated from
975 // touch exploration in Chrome code. 973 // touch exploration in Chrome code.
976 flags |= ui::EF_TOUCH_ACCESSIBILITY; 974 flags |= ui::EF_TOUCH_ACCESSIBILITY;
977 975
978 // TODO(dmazzoni) http://crbug.com/391008 - get rid of this hack. 976 // TODO(dmazzoni) http://crbug.com/391008 - get rid of this hack.
979 // This is a short-term workaround for the limitation that we're using 977 // This is a short-term workaround for the limitation that we're using
980 // the ChromeVox content script to process touch exploration events, but 978 // the ChromeVox content script to process touch exploration events, but
981 // ChromeVox needs a way to distinguish between a real mouse move and a 979 // ChromeVox needs a way to distinguish between a real mouse move and a
982 // mouse move generated from touch exploration, so we have touch exploration 980 // mouse move generated from touch exploration, so we have touch exploration
983 // pretend that the command key was down (which becomes the "meta" key in 981 // pretend that the command key was down (which becomes the "meta" key in
984 // JavaScript). We can remove this hack when the ChromeVox content script 982 // JavaScript). We can remove this hack when the ChromeVox content script
985 // goes away and native accessibility code sends a touch exploration 983 // goes away and native accessibility code sends a touch exploration
986 // event to the new ChromeVox background page via the automation api. 984 // event to the new ChromeVox background page via the automation api.
987 flags |= ui::EF_COMMAND_DOWN; 985 flags |= ui::EF_COMMAND_DOWN;
988 986
989 return make_scoped_ptr(new ui::MouseEvent( 987 return make_scoped_ptr(new ui::MouseEvent(
990 ui::ET_MOUSE_MOVED, location, location, ui::EventTimeForNow(), flags, 0)); 988 ui::ET_MOUSE_MOVED, gfx::PointF(location), gfx::PointF(location),
989 ui::EventTimeForNow(), flags, 0));
991 } 990 }
992 991
993 void TouchExplorationController::EnterTouchToMouseMode() { 992 void TouchExplorationController::EnterTouchToMouseMode() {
994 aura::client::CursorClient* cursor_client = 993 aura::client::CursorClient* cursor_client =
995 aura::client::GetCursorClient(root_window_); 994 aura::client::GetCursorClient(root_window_);
996 if (cursor_client && !cursor_client->IsMouseEventsEnabled()) 995 if (cursor_client && !cursor_client->IsMouseEventsEnabled())
997 cursor_client->EnableMouseEvents(); 996 cursor_client->EnableMouseEvents();
998 if (cursor_client && cursor_client->IsCursorVisible()) 997 if (cursor_client && cursor_client->IsCursorVisible())
999 cursor_client->HideCursor(); 998 cursor_client->HideCursor();
1000 } 999 }
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 up_swipe_gestures_[4] = BindKeyEventWithFlags(VKEY_BROWSER_HOME, ui::EF_NONE); 1149 up_swipe_gestures_[4] = BindKeyEventWithFlags(VKEY_BROWSER_HOME, ui::EF_NONE);
1151 down_swipe_gestures_[4] = 1150 down_swipe_gestures_[4] =
1152 BindKeyEventWithFlags(VKEY_BROWSER_REFRESH, ui::EF_NONE); 1151 BindKeyEventWithFlags(VKEY_BROWSER_REFRESH, ui::EF_NONE);
1153 } 1152 }
1154 1153
1155 float TouchExplorationController::GetSplitTapTouchSlop() { 1154 float TouchExplorationController::GetSplitTapTouchSlop() {
1156 return gesture_detector_config_.touch_slop * 3; 1155 return gesture_detector_config_.touch_slop * 3;
1157 } 1156 }
1158 1157
1159 } // namespace ui 1158 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698