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/wm_shelf.h" | 11 #include "ash/shelf/wm_shelf.h" |
12 #include "ash/shell_port.h" | 12 #include "ash/shell_port.h" |
13 #include "ash/wm/fullscreen_window_finder.h" | 13 #include "ash/wm/fullscreen_window_finder.h" |
14 #include "ash/wm/window_state.h" | 14 #include "ash/wm/window_state.h" |
| 15 #include "ash/wm/window_state_aura.h" |
15 #include "ash/wm/wm_window_animations.h" | 16 #include "ash/wm/wm_window_animations.h" |
16 #include "ash/wm/workspace/workspace_event_handler.h" | 17 #include "ash/wm/workspace/workspace_event_handler.h" |
17 #include "ash/wm/workspace/workspace_layout_manager.h" | 18 #include "ash/wm/workspace/workspace_layout_manager.h" |
18 #include "ash/wm/workspace/workspace_layout_manager_backdrop_delegate.h" | 19 #include "ash/wm/workspace/workspace_layout_manager_backdrop_delegate.h" |
19 #include "ash/wm_window.h" | 20 #include "ash/wm_window.h" |
20 #include "base/memory/ptr_util.h" | 21 #include "base/memory/ptr_util.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 | 25 |
24 namespace ash { | 26 namespace ash { |
25 namespace { | 27 namespace { |
26 | 28 |
27 // Amount of time to pause before animating anything. Only used during initial | 29 // Amount of time to pause before animating anything. Only used during initial |
28 // animation (when logging in). | 30 // animation (when logging in). |
29 const int kInitialPauseTimeMS = 750; | 31 const int kInitialPauseTimeMS = 750; |
30 | 32 |
(...skipping 24 matching lines...) Expand all Loading... |
55 return wm::WORKSPACE_WINDOW_STATE_DEFAULT; | 57 return wm::WORKSPACE_WINDOW_STATE_DEFAULT; |
56 | 58 |
57 const WmWindow* fullscreen = wm::GetWindowForFullscreenMode(viewport_); | 59 const WmWindow* fullscreen = wm::GetWindowForFullscreenMode(viewport_); |
58 if (fullscreen && !fullscreen->GetWindowState()->ignored_by_shelf()) | 60 if (fullscreen && !fullscreen->GetWindowState()->ignored_by_shelf()) |
59 return wm::WORKSPACE_WINDOW_STATE_FULL_SCREEN; | 61 return wm::WORKSPACE_WINDOW_STATE_FULL_SCREEN; |
60 | 62 |
61 const gfx::Rect shelf_bounds(WmShelf::ForWindow(viewport_)->GetIdealBounds()); | 63 const gfx::Rect shelf_bounds(WmShelf::ForWindow(viewport_)->GetIdealBounds()); |
62 bool window_overlaps_launcher = false; | 64 bool window_overlaps_launcher = false; |
63 // The default container may contain windows that may overlap the launcher | 65 // The default container may contain windows that may overlap the launcher |
64 // shelf and affect its transparency. | 66 // shelf and affect its transparency. |
65 WmWindow* container = viewport_->GetRootWindow()->GetChildByShellWindowId( | 67 aura::Window* container = |
66 kShellWindowId_DefaultContainer); | 68 viewport_->GetRootWindow()->aura_window()->GetChildById( |
67 for (WmWindow* window : container->GetChildren()) { | 69 kShellWindowId_DefaultContainer); |
68 wm::WindowState* window_state = window->GetWindowState(); | 70 for (aura::Window* window : container->children()) { |
| 71 wm::WindowState* window_state = wm::GetWindowState(window); |
69 if (window_state->ignored_by_shelf() || | 72 if (window_state->ignored_by_shelf() || |
70 (window->GetLayer() && !window->GetLayer()->GetTargetVisibility())) { | 73 (window->layer() && !window->layer()->GetTargetVisibility())) { |
71 continue; | 74 continue; |
72 } | 75 } |
73 if (window_state->IsMaximized()) | 76 if (window_state->IsMaximized()) |
74 return wm::WORKSPACE_WINDOW_STATE_MAXIMIZED; | 77 return wm::WORKSPACE_WINDOW_STATE_MAXIMIZED; |
75 window_overlaps_launcher |= window->GetBounds().Intersects(shelf_bounds); | 78 window_overlaps_launcher |= window->bounds().Intersects(shelf_bounds); |
76 } | 79 } |
77 | 80 |
78 return window_overlaps_launcher | 81 return window_overlaps_launcher |
79 ? wm::WORKSPACE_WINDOW_STATE_WINDOW_OVERLAPS_SHELF | 82 ? wm::WORKSPACE_WINDOW_STATE_WINDOW_OVERLAPS_SHELF |
80 : wm::WORKSPACE_WINDOW_STATE_DEFAULT; | 83 : wm::WORKSPACE_WINDOW_STATE_DEFAULT; |
81 } | 84 } |
82 | 85 |
83 void WorkspaceController::DoInitialAnimation() { | 86 void WorkspaceController::DoInitialAnimation() { |
84 viewport_->Show(); | 87 viewport_->Show(); |
85 | 88 |
(...skipping 30 matching lines...) Expand all Loading... |
116 void WorkspaceController::OnWindowDestroying(aura::Window* window) { | 119 void WorkspaceController::OnWindowDestroying(aura::Window* window) { |
117 DCHECK_EQ(WmWindow::Get(window), viewport_); | 120 DCHECK_EQ(WmWindow::Get(window), viewport_); |
118 viewport_->aura_window()->RemoveObserver(this); | 121 viewport_->aura_window()->RemoveObserver(this); |
119 viewport_ = nullptr; | 122 viewport_ = nullptr; |
120 // Destroy |event_handler_| too as it depends upon |window|. | 123 // Destroy |event_handler_| too as it depends upon |window|. |
121 event_handler_.reset(); | 124 event_handler_.reset(); |
122 layout_manager_ = nullptr; | 125 layout_manager_ = nullptr; |
123 } | 126 } |
124 | 127 |
125 } // namespace ash | 128 } // namespace ash |
OLD | NEW |