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

Unified Diff: ui/views/events/event.cc

Issue 10154005: views: Some code cleanup: touch-events are not used to generate mouse-events anymore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/events/event.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/events/event.cc
diff --git a/ui/views/events/event.cc b/ui/views/events/event.cc
index f9f8754f83e6d3e131ef77dfaffccfc3291b71cb..6954db664b83215518790d98375e90004f0cc785 100644
--- a/ui/views/events/event.cc
+++ b/ui/views/events/event.cc
@@ -98,41 +98,6 @@ MouseEvent::MouseEvent(const MouseEvent& model, View* source, View* target)
: LocatedEvent(model, source, target) {
}
-MouseEvent::MouseEvent(const TouchEvent& touch)
- : LocatedEvent(touch.native_event()) {
- // The location of the event is correctly extracted from the native event. But
- // it is necessary to update the event type.
- ui::EventType mtype = ui::ET_UNKNOWN;
- switch (touch.type()) {
- case ui::ET_TOUCH_RELEASED:
- mtype = ui::ET_MOUSE_RELEASED;
- break;
- case ui::ET_TOUCH_PRESSED:
- mtype = ui::ET_MOUSE_PRESSED;
- break;
- case ui::ET_TOUCH_MOVED:
- mtype = ui::ET_MOUSE_MOVED;
- break;
- default:
- NOTREACHED() << "Invalid mouse event.";
- }
- set_type(mtype);
-
- // It may not be possible to extract the button-information necessary for a
- // MouseEvent from the native event for a TouchEvent, so the flags are
- // explicitly updated as well. The button is approximated from the touchpoint
- // identity.
- int new_flags = flags() & ~(ui::EF_LEFT_MOUSE_BUTTON |
- ui::EF_RIGHT_MOUSE_BUTTON |
- ui::EF_MIDDLE_MOUSE_BUTTON);
- int button = ui::EF_LEFT_MOUSE_BUTTON;
- if (touch.identity() == 1)
- button = ui::EF_RIGHT_MOUSE_BUTTON;
- else if (touch.identity() == 2)
- button = ui::EF_MIDDLE_MOUSE_BUTTON;
- set_flags(new_flags | button);
-}
-
////////////////////////////////////////////////////////////////////////////////
// MouseWheelEvent, public:
« no previous file with comments | « ui/views/events/event.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698