OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/wm/partial_screenshot_view.h" | 5 #include "ash/wm/partial_screenshot_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/display/mouse_cursor_event_filter.h" | 9 #include "ash/display/mouse_cursor_event_filter.h" |
10 #include "ash/screenshot_delegate.h" | 10 #include "ash/screenshot_delegate.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 it != root_windows.end(); ++it) { | 87 it != root_windows.end(); ++it) { |
88 PartialScreenshotView* new_view = new PartialScreenshotView( | 88 PartialScreenshotView* new_view = new PartialScreenshotView( |
89 overlay_delegate, screenshot_delegate); | 89 overlay_delegate, screenshot_delegate); |
90 new_view->Init(*it); | 90 new_view->Init(*it); |
91 } | 91 } |
92 } | 92 } |
93 | 93 |
94 PartialScreenshotView::PartialScreenshotView( | 94 PartialScreenshotView::PartialScreenshotView( |
95 PartialScreenshotView::OverlayDelegate* overlay_delegate, | 95 PartialScreenshotView::OverlayDelegate* overlay_delegate, |
96 ScreenshotDelegate* screenshot_delegate) | 96 ScreenshotDelegate* screenshot_delegate) |
97 : is_dragging_(false), | 97 : current_touch_id_(-1), |
98 is_dragging_(false), | |
98 overlay_delegate_(overlay_delegate), | 99 overlay_delegate_(overlay_delegate), |
99 screenshot_delegate_(screenshot_delegate) { | 100 screenshot_delegate_(screenshot_delegate) { |
100 } | 101 } |
101 | 102 |
102 PartialScreenshotView::~PartialScreenshotView() { | 103 PartialScreenshotView::~PartialScreenshotView() { |
103 overlay_delegate_ = NULL; | 104 overlay_delegate_ = NULL; |
104 screenshot_delegate_ = NULL; | 105 screenshot_delegate_ = NULL; |
105 } | 106 } |
106 | 107 |
107 void PartialScreenshotView::Init(aura::RootWindow* root_window) { | 108 void PartialScreenshotView::Init(aura::RootWindow* root_window) { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
191 is_dragging_ = false; | 192 is_dragging_ = false; |
192 if (screenshot_delegate_) { | 193 if (screenshot_delegate_) { |
193 aura::RootWindow *root_window = | 194 aura::RootWindow *root_window = |
194 GetWidget()->GetNativeWindow()->GetRootWindow(); | 195 GetWidget()->GetNativeWindow()->GetRootWindow(); |
195 screenshot_delegate_->HandleTakePartialScreenshot( | 196 screenshot_delegate_->HandleTakePartialScreenshot( |
196 root_window, | 197 root_window, |
197 gfx::IntersectRects(root_window->bounds(), GetScreenshotRect())); | 198 gfx::IntersectRects(root_window->bounds(), GetScreenshotRect())); |
198 } | 199 } |
199 } | 200 } |
200 | 201 |
202 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.
| |
203 gfx::Point position = event->location(); | |
204 | |
205 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.
| |
206 return; | |
207 | |
208 if (event->type() == ui::ET_TOUCH_PRESSED) { | |
209 current_touch_id_ = event->touch_id(); | |
210 ui::MouseEvent mouse_event(ui::ET_MOUSE_PRESSED, position, position, 0); | |
211 OnMousePressed(mouse_event); | |
212 } else if (event->type() == ui::ET_TOUCH_MOVED) { | |
213 ui::MouseEvent mouse_event(ui::ET_MOUSE_DRAGGED, position, position, 0); | |
214 OnMouseDragged(mouse_event); | |
215 } else if (event->type() == ui::ET_TOUCH_RELEASED || | |
216 event->type() == ui::ET_TOUCH_CANCELLED) { | |
217 current_touch_id_ = -1; | |
218 ui::MouseEvent mouse_event(ui::ET_MOUSE_RELEASED, position, position, 0); | |
219 OnMouseReleased(mouse_event); | |
220 } | |
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.
| |
221 | |
222 event->SetHandled(); | |
223 } | |
224 | |
201 } // namespace ash | 225 } // namespace ash |
OLD | NEW |