OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/wm/workspace_controller.h" | 5 #include "ash/wm/workspace_controller.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "ash/public/cpp/shell_window_ids.h" | 9 #include "ash/public/cpp/shell_window_ids.h" |
10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
11 #include "ash/shelf/shelf.h" | 11 #include "ash/shelf/shelf.h" |
| 12 #include "ash/shell.h" |
12 #include "ash/shell_port.h" | 13 #include "ash/shell_port.h" |
13 #include "ash/wm/fullscreen_window_finder.h" | 14 #include "ash/wm/fullscreen_window_finder.h" |
| 15 #include "ash/wm/mru_window_tracker.h" |
14 #include "ash/wm/window_state.h" | 16 #include "ash/wm/window_state.h" |
15 #include "ash/wm/wm_window_animations.h" | 17 #include "ash/wm/wm_window_animations.h" |
16 #include "ash/wm/workspace/backdrop_controller.h" | 18 #include "ash/wm/workspace/backdrop_controller.h" |
17 #include "ash/wm/workspace/backdrop_delegate.h" | 19 #include "ash/wm/workspace/backdrop_delegate.h" |
18 #include "ash/wm/workspace/workspace_event_handler.h" | 20 #include "ash/wm/workspace/workspace_event_handler.h" |
19 #include "ash/wm/workspace/workspace_layout_manager.h" | 21 #include "ash/wm/workspace/workspace_layout_manager.h" |
20 #include "ui/aura/window.h" | 22 #include "ui/aura/window.h" |
21 #include "ui/compositor/layer.h" | 23 #include "ui/compositor/layer.h" |
22 #include "ui/compositor/scoped_layer_animation_settings.h" | 24 #include "ui/compositor/scoped_layer_animation_settings.h" |
23 #include "ui/wm/core/window_animations.h" | 25 #include "ui/wm/core/window_animations.h" |
(...skipping 30 matching lines...) Expand all Loading... |
54 wm::WorkspaceWindowState WorkspaceController::GetWindowState() const { | 56 wm::WorkspaceWindowState WorkspaceController::GetWindowState() const { |
55 if (!viewport_) | 57 if (!viewport_) |
56 return wm::WORKSPACE_WINDOW_STATE_DEFAULT; | 58 return wm::WORKSPACE_WINDOW_STATE_DEFAULT; |
57 | 59 |
58 const aura::Window* fullscreen = wm::GetWindowForFullscreenMode(viewport_); | 60 const aura::Window* fullscreen = wm::GetWindowForFullscreenMode(viewport_); |
59 if (fullscreen && !wm::GetWindowState(fullscreen)->ignored_by_shelf()) | 61 if (fullscreen && !wm::GetWindowState(fullscreen)->ignored_by_shelf()) |
60 return wm::WORKSPACE_WINDOW_STATE_FULL_SCREEN; | 62 return wm::WORKSPACE_WINDOW_STATE_FULL_SCREEN; |
61 | 63 |
62 const gfx::Rect shelf_bounds(Shelf::ForWindow(viewport_)->GetIdealBounds()); | 64 const gfx::Rect shelf_bounds(Shelf::ForWindow(viewport_)->GetIdealBounds()); |
63 bool window_overlaps_launcher = false; | 65 bool window_overlaps_launcher = false; |
64 // The default container may contain windows that may overlap the launcher | 66 auto mru_list = Shell::Get()->mru_window_tracker()->BuildMruWindowList(); |
65 // shelf and affect its transparency. | 67 |
66 aura::Window* container = | 68 for (aura::Window* window : mru_list) { |
67 viewport_->GetRootWindow()->GetChildById(kShellWindowId_DefaultContainer); | 69 if (window->GetRootWindow() != viewport_->GetRootWindow()) |
68 for (aura::Window* window : container->children()) { | 70 continue; |
69 wm::WindowState* window_state = wm::GetWindowState(window); | 71 wm::WindowState* window_state = wm::GetWindowState(window); |
70 if (window_state->ignored_by_shelf() || | 72 if (window_state->ignored_by_shelf() || |
71 (window->layer() && !window->layer()->GetTargetVisibility())) { | 73 (window->layer() && !window->layer()->GetTargetVisibility())) { |
72 continue; | 74 continue; |
73 } | 75 } |
74 if (window_state->IsMaximized()) | 76 if (window_state->IsMaximized()) |
75 return wm::WORKSPACE_WINDOW_STATE_MAXIMIZED; | 77 return wm::WORKSPACE_WINDOW_STATE_MAXIMIZED; |
76 window_overlaps_launcher |= window->bounds().Intersects(shelf_bounds); | 78 window_overlaps_launcher |= window->bounds().Intersects(shelf_bounds); |
77 } | 79 } |
78 | 80 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 void WorkspaceController::OnWindowDestroying(aura::Window* window) { | 119 void WorkspaceController::OnWindowDestroying(aura::Window* window) { |
118 DCHECK_EQ(window, viewport_); | 120 DCHECK_EQ(window, viewport_); |
119 viewport_->RemoveObserver(this); | 121 viewport_->RemoveObserver(this); |
120 viewport_ = nullptr; | 122 viewport_ = nullptr; |
121 // Destroy |event_handler_| too as it depends upon |window|. | 123 // Destroy |event_handler_| too as it depends upon |window|. |
122 event_handler_.reset(); | 124 event_handler_.reset(); |
123 layout_manager_ = nullptr; | 125 layout_manager_ = nullptr; |
124 } | 126 } |
125 | 127 |
126 } // namespace ash | 128 } // namespace ash |
OLD | NEW |