Commit f8997c62 authored by Xiaoqian Dai's avatar Xiaoqian Dai Committed by Chromium LUCI CQ

capture mode: exclude home screen window from window capture mode.

Bug: 1160367
Change-Id: If3ebbe49d221e41bd19f495fcadb5881a0252e1e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2600043Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Commit-Queue: Xiaoqian Dai <xdai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#838699}
parent 24eb7d94
......@@ -19,6 +19,7 @@
#include "ash/display/cursor_window_controller.h"
#include "ash/display/screen_orientation_controller_test_api.h"
#include "ash/display/window_tree_host_manager.h"
#include "ash/home_screen/home_screen_controller.h"
#include "ash/magnifier/magnifier_glass.h"
#include "ash/public/cpp/ash_features.h"
#include "ash/root_window_controller.h"
......@@ -1925,9 +1926,10 @@ TEST_F(CaptureModeTest, TabletTouchCaptureLabelWidgetWindowMode) {
event_generator->PressTouch();
event_generator->ReleaseTouch();
// There are no windows so the window finder algorithm will find the app list
// window and take a picture of that, ending capture mode.
EXPECT_FALSE(controller->IsActive());
// There are no windows and home screen window is excluded from window capture
// mode, so capture mode will still remain active.
EXPECT_TRUE(Shell::Get()->home_screen_controller()->IsHomeScreenVisible());
EXPECT_TRUE(controller->IsActive());
}
// Tests that after rotating a display, the capture session widgets are updated
......
......@@ -5,6 +5,8 @@
#include "ash/capture_mode/capture_window_observer.h"
#include "ash/capture_mode/capture_mode_session.h"
#include "ash/home_screen/home_screen_controller.h"
#include "ash/home_screen/home_screen_delegate.h"
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/public/cpp/window_finder.h"
#include "ash/shell.h"
......@@ -40,6 +42,14 @@ void CaptureWindowObserver::UpdateSelectedWindowAtPosition(
window = nullptr;
}
// Don't capture home screen window.
if (window && window == Shell::Get()
->home_screen_controller()
->delegate()
->GetHomeScreenWindow()) {
window = nullptr;
}
// Stop observing the current selected window if there is one.
StopObserving();
if (window)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment