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

Unified Diff: ash/wm/partial_screenshot_view.cc

Issue 13006010: Add support for taking partial screenshot using touch (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 9 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 | « ash/wm/partial_screenshot_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/partial_screenshot_view.cc
diff --git a/ash/wm/partial_screenshot_view.cc b/ash/wm/partial_screenshot_view.cc
index 03116e7cf941e30e3b8ef3ecbbbec902a3895c12..f09f381a88d4fa04115c73ff4ef5b4877c716001 100644
--- a/ash/wm/partial_screenshot_view.cc
+++ b/ash/wm/partial_screenshot_view.cc
@@ -94,7 +94,8 @@ void PartialScreenshotView::StartPartialScreenshot(
PartialScreenshotView::PartialScreenshotView(
PartialScreenshotView::OverlayDelegate* overlay_delegate,
ScreenshotDelegate* screenshot_delegate)
- : is_dragging_(false),
+ : current_touch_id_(-1),
+ is_dragging_(false),
overlay_delegate_(overlay_delegate),
screenshot_delegate_(screenshot_delegate) {
}
@@ -198,4 +199,27 @@ void PartialScreenshotView::OnMouseReleased(const ui::MouseEvent& event) {
}
}
+void PartialScreenshotView::OnTouchEvent(ui::TouchEvent* event) {
sadrul 2013/03/25 21:11:04 You should override OnGestureEvent, and use scroll
Yufeng Shen (Slow to review) 2013/03/25 22:03:34 Done.
+ gfx::Point position = event->location();
+
+ if (current_touch_id_ != -1 && current_touch_id_ != event->touch_id())
Jun Mukai 2013/03/25 21:03:48 So, this will ignore the second finger touch right
Yufeng Shen (Slow to review) 2013/03/25 22:03:34 I will put a note in the crbug.
+ return;
+
+ if (event->type() == ui::ET_TOUCH_PRESSED) {
+ current_touch_id_ = event->touch_id();
+ ui::MouseEvent mouse_event(ui::ET_MOUSE_PRESSED, position, position, 0);
+ OnMousePressed(mouse_event);
+ } else if (event->type() == ui::ET_TOUCH_MOVED) {
+ ui::MouseEvent mouse_event(ui::ET_MOUSE_DRAGGED, position, position, 0);
+ OnMouseDragged(mouse_event);
+ } else if (event->type() == ui::ET_TOUCH_RELEASED ||
+ event->type() == ui::ET_TOUCH_CANCELLED) {
+ current_touch_id_ = -1;
+ ui::MouseEvent mouse_event(ui::ET_MOUSE_RELEASED, position, position, 0);
+ OnMouseReleased(mouse_event);
+ }
Jun Mukai 2013/03/25 21:03:48 This is okay, but creating dummy mouse event doesn
sadrul 2013/03/25 21:11:04 +1. This is usually how it's done in other parts o
Yufeng Shen (Slow to review) 2013/03/25 22:03:34 Done.
+
+ event->SetHandled();
+}
+
} // namespace ash
« no previous file with comments | « ash/wm/partial_screenshot_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698