| 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 } | 189 } |
| 190 } | 190 } |
| 191 | 191 |
| 192 bool PartialScreenshotView::OnMousePressed(const ui::MouseEvent& event) { | 192 bool PartialScreenshotView::OnMousePressed(const ui::MouseEvent& event) { |
| 193 // Prevent moving across displays during drag. Capturing a screenshot across | 193 // Prevent moving across displays during drag. Capturing a screenshot across |
| 194 // the displays is not supported yet. | 194 // the displays is not supported yet. |
| 195 // TODO(mukai): remove this restriction. | 195 // TODO(mukai): remove this restriction. |
| 196 MouseCursorEventFilter* mouse_cursor_filter = | 196 MouseCursorEventFilter* mouse_cursor_filter = |
| 197 Shell::GetInstance()->mouse_cursor_filter(); | 197 Shell::GetInstance()->mouse_cursor_filter(); |
| 198 mouse_cursor_filter->set_mouse_warp_mode(MouseCursorEventFilter::WARP_NONE); | 198 mouse_cursor_filter->set_mouse_warp_mode(MouseCursorEventFilter::WARP_NONE); |
| 199 OnSelectionStarted(event.location()); | 199 OnSelectionStarted(gfx::ToFlooredPoint(event.location())); |
| 200 return true; | 200 return true; |
| 201 } | 201 } |
| 202 | 202 |
| 203 bool PartialScreenshotView::OnMouseDragged(const ui::MouseEvent& event) { | 203 bool PartialScreenshotView::OnMouseDragged(const ui::MouseEvent& event) { |
| 204 OnSelectionChanged(event.location()); | 204 OnSelectionChanged(gfx::ToFlooredPoint(event.location())); |
| 205 return true; | 205 return true; |
| 206 } | 206 } |
| 207 | 207 |
| 208 bool PartialScreenshotView::OnMouseWheel(const ui::MouseWheelEvent& event) { | 208 bool PartialScreenshotView::OnMouseWheel(const ui::MouseWheelEvent& event) { |
| 209 // Do nothing but do not propagate events futhermore. | 209 // Do nothing but do not propagate events futhermore. |
| 210 return true; | 210 return true; |
| 211 } | 211 } |
| 212 | 212 |
| 213 void PartialScreenshotView::OnMouseReleased(const ui::MouseEvent& event) { | 213 void PartialScreenshotView::OnMouseReleased(const ui::MouseEvent& event) { |
| 214 OnSelectionFinished(); | 214 OnSelectionFinished(); |
| 215 } | 215 } |
| 216 | 216 |
| 217 void PartialScreenshotView::OnMouseCaptureLost() { | 217 void PartialScreenshotView::OnMouseCaptureLost() { |
| 218 is_dragging_ = false; | 218 is_dragging_ = false; |
| 219 OnSelectionFinished(); | 219 OnSelectionFinished(); |
| 220 } | 220 } |
| 221 | 221 |
| 222 void PartialScreenshotView::OnGestureEvent(ui::GestureEvent* event) { | 222 void PartialScreenshotView::OnGestureEvent(ui::GestureEvent* event) { |
| 223 switch(event->type()) { | 223 switch(event->type()) { |
| 224 case ui::ET_GESTURE_TAP_DOWN: | 224 case ui::ET_GESTURE_TAP_DOWN: |
| 225 OnSelectionStarted(event->location()); | 225 OnSelectionStarted(gfx::ToFlooredPoint(event->location())); |
| 226 break; | 226 break; |
| 227 case ui::ET_GESTURE_SCROLL_UPDATE: | 227 case ui::ET_GESTURE_SCROLL_UPDATE: |
| 228 OnSelectionChanged(event->location()); | 228 OnSelectionChanged(gfx::ToFlooredPoint(event->location())); |
| 229 break; | 229 break; |
| 230 case ui::ET_GESTURE_SCROLL_END: | 230 case ui::ET_GESTURE_SCROLL_END: |
| 231 case ui::ET_SCROLL_FLING_START: | 231 case ui::ET_SCROLL_FLING_START: |
| 232 OnSelectionFinished(); | 232 OnSelectionFinished(); |
| 233 break; | 233 break; |
| 234 default: | 234 default: |
| 235 break; | 235 break; |
| 236 } | 236 } |
| 237 | 237 |
| 238 event->SetHandled(); | 238 event->SetHandled(); |
| 239 } | 239 } |
| 240 | 240 |
| 241 } // namespace ash | 241 } // namespace ash |
| OLD | NEW |