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

Side by Side Diff: ash/utility/screenshot_controller.cc

Issue 2324803003: cros/ash: Cancel screenshot mode if screenshot is cancelled or not taken. (Closed)
Patch Set: Rebase Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « ash/utility/screenshot_controller.h ('k') | chrome/browser/ui/ash/palette_delegate_chromeos.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « ash/utility/screenshot_controller.h ('k') | chrome/browser/ui/ash/palette_delegate_chromeos.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698