Commit 754ce948 authored by muyuanli's avatar muyuanli Committed by Commit Bot

collect windows from mru_list in workspace_controller.

BUG=b:38505617
TEST=
  ash_unittests on ShelfLayoutManagerTest.AutohideShelfForAutohideWhenActiveWindow
  ash unittests on AppListPresenterDelegateTest.ShelfBackgroundRespondsToAppListBeingShown

Review-Url: https://codereview.chromium.org/2967543003
Cr-Commit-Position: refs/heads/master@{#486462}
parent d4f5c197
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "ash/shelf/shelf_widget.h" #include "ash/shelf/shelf_widget.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/wm/maximize_mode/maximize_mode_controller.h" #include "ash/wm/maximize_mode/maximize_mode_controller.h"
#include "ash/wm/window_state.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "ui/app_list/app_list_constants.h" #include "ui/app_list/app_list_constants.h"
#include "ui/app_list/app_list_features.h" #include "ui/app_list/app_list_features.h"
...@@ -120,6 +121,8 @@ void AppListPresenterDelegate::Init(app_list::AppListView* view, ...@@ -120,6 +121,8 @@ void AppListPresenterDelegate::Init(app_list::AppListView* view,
view->MaybeSetAnchorPoint(GetCenterOfDisplayForWindow( view->MaybeSetAnchorPoint(GetCenterOfDisplayForWindow(
root_window, GetMinimumBoundsHeightForAppList(view))); root_window, GetMinimumBoundsHeightForAppList(view)));
} }
wm::GetWindowState(view->GetWidget()->GetNativeWindow())
->set_ignored_by_shelf(true);
keyboard::KeyboardController* keyboard_controller = keyboard::KeyboardController* keyboard_controller =
keyboard::KeyboardController::GetInstance(); keyboard::KeyboardController::GetInstance();
if (keyboard_controller) if (keyboard_controller)
......
...@@ -699,6 +699,8 @@ TEST_F(AppListPresenterDelegateTest, ...@@ -699,6 +699,8 @@ TEST_F(AppListPresenterDelegateTest,
app_list_presenter_impl()->Show(GetPrimaryDisplayId()); app_list_presenter_impl()->Show(GetPrimaryDisplayId());
EXPECT_TRUE(app_list::features::IsFullscreenAppListEnabled()); EXPECT_TRUE(app_list::features::IsFullscreenAppListEnabled());
EXPECT_FALSE(GetPrimaryShelf()->IsHorizontalAlignment()); EXPECT_FALSE(GetPrimaryShelf()->IsHorizontalAlignment());
// TODO(muyuanli): This should be SHELF_BACKGROUND_OVERLAP but the test
// construction code is not quite correct. See crbug.com/742461.
EXPECT_EQ(GetPrimaryShelf()->shelf_layout_manager()->GetShelfBackgroundType(), EXPECT_EQ(GetPrimaryShelf()->shelf_layout_manager()->GetShelfBackgroundType(),
SHELF_BACKGROUND_DEFAULT); SHELF_BACKGROUND_DEFAULT);
} }
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "ash/focus_cycler.h" #include "ash/focus_cycler.h"
#include "ash/public/cpp/config.h" #include "ash/public/cpp/config.h"
#include "ash/public/cpp/shell_window_ids.h" #include "ash/public/cpp/shell_window_ids.h"
#include "ash/root_window_controller.h"
#include "ash/session/session_controller.h" #include "ash/session/session_controller.h"
#include "ash/shelf/shelf.h" #include "ash/shelf/shelf.h"
#include "ash/shelf/shelf_constants.h" #include "ash/shelf/shelf_constants.h"
...@@ -1559,6 +1560,24 @@ TEST_F(ShelfLayoutManagerTest, AutohideShelfForAutohideWhenActiveWindow) { ...@@ -1559,6 +1560,24 @@ TEST_F(ShelfLayoutManagerTest, AutohideShelfForAutohideWhenActiveWindow) {
->set_autohide_shelf_when_maximized_or_fullscreen(false); ->set_autohide_shelf_when_maximized_or_fullscreen(false);
widget_two->Activate(); widget_two->Activate();
EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState());
wm::GetWindowState(window_two)
->set_autohide_shelf_when_maximized_or_fullscreen(true);
window_two->SetProperty(aura::client::kAlwaysOnTopKey, true);
auto* shelf_window = shelf->GetWindow();
aura::Window* container = shelf_window->GetRootWindow()->GetChildById(
kShellWindowId_AlwaysOnTopContainer);
auto iter = std::find(container->children().begin(),
container->children().end(), window_two);
EXPECT_NE(iter, container->children().end());
widget_two->Maximize();
EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
wm::WorkspaceWindowState window_state =
RootWindowController::ForWindow(shelf_window)->GetWorkspaceWindowState();
EXPECT_EQ(wm::WORKSPACE_WINDOW_STATE_MAXIMIZED, window_state);
} }
TEST_F(ShelfLayoutManagerTest, ShelfFlickerOnTrayActivation) { TEST_F(ShelfLayoutManagerTest, ShelfFlickerOnTrayActivation) {
......
...@@ -9,8 +9,10 @@ ...@@ -9,8 +9,10 @@
#include "ash/public/cpp/shell_window_ids.h" #include "ash/public/cpp/shell_window_ids.h"
#include "ash/root_window_controller.h" #include "ash/root_window_controller.h"
#include "ash/shelf/shelf.h" #include "ash/shelf/shelf.h"
#include "ash/shell.h"
#include "ash/shell_port.h" #include "ash/shell_port.h"
#include "ash/wm/fullscreen_window_finder.h" #include "ash/wm/fullscreen_window_finder.h"
#include "ash/wm/mru_window_tracker.h"
#include "ash/wm/window_state.h" #include "ash/wm/window_state.h"
#include "ash/wm/wm_window_animations.h" #include "ash/wm/wm_window_animations.h"
#include "ash/wm/workspace/backdrop_controller.h" #include "ash/wm/workspace/backdrop_controller.h"
...@@ -61,11 +63,11 @@ wm::WorkspaceWindowState WorkspaceController::GetWindowState() const { ...@@ -61,11 +63,11 @@ wm::WorkspaceWindowState WorkspaceController::GetWindowState() const {
const gfx::Rect shelf_bounds(Shelf::ForWindow(viewport_)->GetIdealBounds()); const gfx::Rect shelf_bounds(Shelf::ForWindow(viewport_)->GetIdealBounds());
bool window_overlaps_launcher = false; bool window_overlaps_launcher = false;
// The default container may contain windows that may overlap the launcher auto mru_list = Shell::Get()->mru_window_tracker()->BuildMruWindowList();
// shelf and affect its transparency.
aura::Window* container = for (aura::Window* window : mru_list) {
viewport_->GetRootWindow()->GetChildById(kShellWindowId_DefaultContainer); if (window->GetRootWindow() != viewport_->GetRootWindow())
for (aura::Window* window : container->children()) { continue;
wm::WindowState* window_state = wm::GetWindowState(window); wm::WindowState* window_state = wm::GetWindowState(window);
if (window_state->ignored_by_shelf() || if (window_state->ignored_by_shelf() ||
(window->layer() && !window->layer()->GetTargetVisibility())) { (window->layer() && !window->layer()->GetTargetVisibility())) {
......
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