OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/utility/screenshot_controller.h" | 5 #include "ash/utility/screenshot_controller.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "ash/common/shell_window_ids.h" | 9 #include "ash/common/shell_window_ids.h" |
10 #include "ash/display/mouse_cursor_event_filter.h" | 10 #include "ash/display/mouse_cursor_event_filter.h" |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 void ScreenshotController::CancelScreenshotSession() { | 301 void ScreenshotController::CancelScreenshotSession() { |
302 mode_ = NONE; | 302 mode_ = NONE; |
303 pen_events_only_ = false; | 303 pen_events_only_ = false; |
304 root_window_ = nullptr; | 304 root_window_ = nullptr; |
305 SetSelectedWindow(nullptr); | 305 SetSelectedWindow(nullptr); |
306 screenshot_delegate_ = nullptr; | 306 screenshot_delegate_ = nullptr; |
307 display::Screen::GetScreen()->RemoveObserver(this); | 307 display::Screen::GetScreen()->RemoveObserver(this); |
308 base::STLDeleteValues(&layers_); | 308 base::STLDeleteValues(&layers_); |
309 cursor_setter_.reset(); | 309 cursor_setter_.reset(); |
310 EnableMouseWarp(true); | 310 EnableMouseWarp(true); |
| 311 |
| 312 if (on_screenshot_session_done_) { |
| 313 // Copy the closure to a temporary value so that if it calls |
| 314 // CancelScreenshotSession we do not loop forever. |
| 315 base::Closure on_done = on_screenshot_session_done_; |
| 316 on_screenshot_session_done_.Reset(); |
| 317 on_done.Run(); |
| 318 } |
311 } | 319 } |
312 | 320 |
313 void ScreenshotController::MaybeStart(const ui::LocatedEvent& event) { | 321 void ScreenshotController::MaybeStart(const ui::LocatedEvent& event) { |
314 aura::Window* current_root = | 322 aura::Window* current_root = |
315 static_cast<aura::Window*>(event.target())->GetRootWindow(); | 323 static_cast<aura::Window*>(event.target())->GetRootWindow(); |
316 if (root_window_) { | 324 if (root_window_) { |
317 // It's already started. This can happen when the second finger touches | 325 // It's already started. This can happen when the second finger touches |
318 // the screen, or combination of the touch and mouse. We should grab the | 326 // the screen, or combination of the touch and mouse. We should grab the |
319 // partial screenshot instead of restarting. | 327 // partial screenshot instead of restarting. |
320 if (current_root == root_window_) { | 328 if (current_root == root_window_) { |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 | 542 |
535 void ScreenshotController::OnDisplayMetricsChanged( | 543 void ScreenshotController::OnDisplayMetricsChanged( |
536 const display::Display& display, | 544 const display::Display& display, |
537 uint32_t changed_metrics) {} | 545 uint32_t changed_metrics) {} |
538 | 546 |
539 void ScreenshotController::OnWindowDestroying(aura::Window* window) { | 547 void ScreenshotController::OnWindowDestroying(aura::Window* window) { |
540 SetSelectedWindow(nullptr); | 548 SetSelectedWindow(nullptr); |
541 } | 549 } |
542 | 550 |
543 } // namespace ash | 551 } // namespace ash |
OLD | NEW |