OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/html_viewer/touch_handler.h" | 5 #include "components/html_viewer/touch_handler.h" |
6 | 6 |
7 #include "third_party/WebKit/public/web/WebInputEvent.h" | 7 #include "third_party/WebKit/public/web/WebInputEvent.h" |
8 #include "third_party/WebKit/public/web/WebView.h" | 8 #include "third_party/WebKit/public/web/WebView.h" |
9 #include "ui/events/blink/blink_event_util.h" | 9 #include "ui/events/blink/blink_event_util.h" |
10 #include "ui/events/gesture_detection/gesture_provider_config_helper.h" | 10 #include "ui/events/gesture_detection/gesture_provider_config_helper.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
63 web_view_->handleInputEvent(web_gesture); | 63 web_view_->handleInputEvent(web_gesture); |
64 } | 64 } |
65 | 65 |
66 bool TouchHandler::UpdateMotionEvent(const mojo::Event& event) { | 66 bool TouchHandler::UpdateMotionEvent(const mojo::Event& event) { |
67 ui::PointerProperties properties; | 67 ui::PointerProperties properties; |
68 SetPropertiesFromEvent(event, &properties); | 68 SetPropertiesFromEvent(event, &properties); |
69 | 69 |
70 const base::TimeTicks timestamp( | 70 const base::TimeTicks timestamp( |
71 base::TimeTicks::FromInternalValue(event.time_stamp)); | 71 base::TimeTicks::FromInternalValue(event.time_stamp)); |
72 if (current_motion_event_.get()) { | 72 if (current_motion_event_.get()) { |
73 current_motion_event_->set_id(current_motion_event_->GetId() + 1); | |
sky
2015/04/28 17:00:19
current_motion_event_ lives for quite a while (it'
| |
74 current_motion_event_->set_event_time(timestamp); | 73 current_motion_event_->set_event_time(timestamp); |
75 } | 74 } |
76 | 75 |
77 switch (event.action) { | 76 switch (event.action) { |
78 case mojo::EVENT_TYPE_POINTER_DOWN: | 77 case mojo::EVENT_TYPE_POINTER_DOWN: |
79 if (!current_motion_event_.get()) { | 78 if (!current_motion_event_.get()) { |
80 current_motion_event_.reset(new ui::MotionEventGeneric( | 79 current_motion_event_.reset(new ui::MotionEventGeneric( |
81 ui::MotionEvent::ACTION_DOWN, timestamp, properties)); | 80 ui::MotionEvent::ACTION_DOWN, timestamp, properties)); |
82 } else { | 81 } else { |
83 const int index = | 82 const int index = |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
178 case mojo::EVENT_TYPE_POINTER_CANCEL: | 177 case mojo::EVENT_TYPE_POINTER_CANCEL: |
179 current_motion_event_.reset(); | 178 current_motion_event_.reset(); |
180 break; | 179 break; |
181 | 180 |
182 default: | 181 default: |
183 break; | 182 break; |
184 } | 183 } |
185 } | 184 } |
186 | 185 |
187 } // namespace html_viewer | 186 } // namespace html_viewer |
OLD | NEW |