Chromium Code Reviews| Index: ash/utility/screenshot_controller.cc |
| diff --git a/ash/utility/screenshot_controller.cc b/ash/utility/screenshot_controller.cc |
| index 64e4f99785f09fd729063fb9d05434708c248969..9bd71f8e442e9eab816b0fbdc6efa84146136299 100644 |
| --- a/ash/utility/screenshot_controller.cc |
| +++ b/ash/utility/screenshot_controller.cc |
| @@ -12,7 +12,6 @@ |
| #include "ash/shell.h" |
| #include "ash/wm/window_util.h" |
| #include "base/memory/ptr_util.h" |
| -#include "ui/aura/client/capture_client.h" |
| #include "ui/aura/client/screen_position_client.h" |
| #include "ui/aura/window_targeter.h" |
| #include "ui/compositor/paint_recorder.h" |
| @@ -62,17 +61,10 @@ class ScreenshotWindowTargeter : public aura::WindowTargeter { |
| gfx::Point target_location = event->location(); |
| event->set_location(location); |
| - |
| - // Ignore capture window when finding the target for located event. |
|
Evan Stade
2016/10/06 16:32:34
so I noticed this bit of code as well, which seems
oshima
2016/10/06 20:07:53
This is to deal with menu windows, so please do no
|
| - aura::client::CaptureClient* original_capture_client = |
| - aura::client::GetCaptureClient(root_window); |
| - aura::client::SetCaptureClient(root_window, nullptr); |
| - |
| aura::Window* selected = |
| static_cast<aura::Window*>(FindTargetForEvent(root_window, event)); |
| // Restore State. |
| - aura::client::SetCaptureClient(root_window, original_capture_client); |
| event->set_location(target_location); |
| return selected; |
| } |
| @@ -255,15 +247,20 @@ void ScreenshotController::StartWindowScreenshotSession( |
| DCHECK_EQ(screenshot_delegate_, screenshot_delegate); |
| return; |
| } |
| - screenshot_delegate_ = screenshot_delegate; |
| - mode_ = WINDOW; |
| - display::Screen::GetScreen()->AddObserver(this); |
| for (aura::Window* root : Shell::GetAllRootWindows()) { |
| + // Since we'll be pre-handling all mouse events, break any existing |
| + // captures. |
| + aura::client::GetCaptureClient(root)->SetCapture(nullptr); |
| layers_[root] = base::MakeUnique<ScreenshotLayer>( |
| Shell::GetContainer(root, kShellWindowId_OverlayContainer)->layer(), |
| true); |
| } |
| + |
| + screenshot_delegate_ = screenshot_delegate; |
| + mode_ = WINDOW; |
| + |
| + display::Screen::GetScreen()->AddObserver(this); |
| SetSelectedWindow(wm::GetActiveWindow()); |
| cursor_setter_.reset(new ScopedCursorSetter( |
| @@ -281,15 +278,19 @@ void ScreenshotController::StartPartialScreenshotSession( |
| return; |
| } |
| - screenshot_delegate_ = screenshot_delegate; |
| - mode_ = PARTIAL; |
| - display::Screen::GetScreen()->AddObserver(this); |
| for (aura::Window* root : Shell::GetAllRootWindows()) { |
| + // Since we'll be pre-handling all mouse events, break any existing |
| + // captures. |
| + aura::client::GetCaptureClient(root)->SetCapture(nullptr); |
| layers_[root] = base::MakeUnique<ScreenshotLayer>( |
| Shell::GetContainer(root, kShellWindowId_OverlayContainer)->layer(), |
| draw_overlay_immediately); |
| } |
| + screenshot_delegate_ = screenshot_delegate; |
| + mode_ = PARTIAL; |
| + display::Screen::GetScreen()->AddObserver(this); |
| + |
| if (!pen_events_only_) { |
| cursor_setter_.reset(new ScopedCursorSetter( |
| Shell::GetInstance()->cursor_manager(), ui::kCursorCross)); |