| 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/common/wm/workspace/workspace_layout_manager.h" | 5 #include "ash/common/wm/workspace/workspace_layout_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/common/wm/always_on_top_controller.h" | 9 #include "ash/common/wm/always_on_top_controller.h" |
| 10 #include "ash/common/wm/fullscreen_window_finder.h" | 10 #include "ash/common/wm/fullscreen_window_finder.h" |
| 11 #include "ash/common/wm/window_positioner.h" | 11 #include "ash/common/wm/window_positioner.h" |
| 12 #include "ash/common/wm/window_state.h" | 12 #include "ash/common/wm/window_state.h" |
| 13 #include "ash/common/wm/wm_event.h" | 13 #include "ash/common/wm/wm_event.h" |
| 14 #include "ash/common/wm/wm_globals.h" | |
| 15 #include "ash/common/wm/wm_root_window_controller.h" | |
| 16 #include "ash/common/wm/wm_screen_util.h" | 14 #include "ash/common/wm/wm_screen_util.h" |
| 17 #include "ash/common/wm/wm_window.h" | |
| 18 #include "ash/common/wm/wm_window_property.h" | |
| 19 #include "ash/common/wm/workspace/workspace_layout_manager_backdrop_delegate.h" | 15 #include "ash/common/wm/workspace/workspace_layout_manager_backdrop_delegate.h" |
| 20 #include "ash/common/wm/workspace/workspace_layout_manager_delegate.h" | 16 #include "ash/common/wm/workspace/workspace_layout_manager_delegate.h" |
| 17 #include "ash/common/wm_root_window_controller.h" |
| 18 #include "ash/common/wm_shell.h" |
| 19 #include "ash/common/wm_window.h" |
| 20 #include "ash/common/wm_window_property.h" |
| 21 #include "ui/compositor/layer.h" | 21 #include "ui/compositor/layer.h" |
| 22 #include "ui/keyboard/keyboard_controller_observer.h" | 22 #include "ui/keyboard/keyboard_controller_observer.h" |
| 23 | 23 |
| 24 namespace ash { | 24 namespace ash { |
| 25 | 25 |
| 26 WorkspaceLayoutManager::WorkspaceLayoutManager( | 26 WorkspaceLayoutManager::WorkspaceLayoutManager( |
| 27 wm::WmWindow* window, | 27 WmWindow* window, |
| 28 std::unique_ptr<wm::WorkspaceLayoutManagerDelegate> delegate) | 28 std::unique_ptr<wm::WorkspaceLayoutManagerDelegate> delegate) |
| 29 : window_(window), | 29 : window_(window), |
| 30 root_window_(window->GetRootWindow()), | 30 root_window_(window->GetRootWindow()), |
| 31 root_window_controller_(root_window_->GetRootWindowController()), | 31 root_window_controller_(root_window_->GetRootWindowController()), |
| 32 globals_(window_->GetGlobals()), | 32 shell_(window_->GetShell()), |
| 33 delegate_(std::move(delegate)), | 33 delegate_(std::move(delegate)), |
| 34 work_area_in_parent_(wm::GetDisplayWorkAreaBounds(window_)), | 34 work_area_in_parent_(wm::GetDisplayWorkAreaBounds(window_)), |
| 35 is_fullscreen_(wm::GetWindowForFullscreenMode(window) != nullptr) { | 35 is_fullscreen_(wm::GetWindowForFullscreenMode(window) != nullptr) { |
| 36 globals_->AddActivationObserver(this); | 36 shell_->AddActivationObserver(this); |
| 37 root_window_->AddObserver(this); | 37 root_window_->AddObserver(this); |
| 38 root_window_controller_->AddObserver(this); | 38 root_window_controller_->AddObserver(this); |
| 39 DCHECK(window->GetBoolProperty( | 39 DCHECK(window->GetBoolProperty( |
| 40 wm::WmWindowProperty::SNAP_CHILDREN_TO_PIXEL_BOUNDARY)); | 40 WmWindowProperty::SNAP_CHILDREN_TO_PIXEL_BOUNDARY)); |
| 41 } | 41 } |
| 42 | 42 |
| 43 WorkspaceLayoutManager::~WorkspaceLayoutManager() { | 43 WorkspaceLayoutManager::~WorkspaceLayoutManager() { |
| 44 if (root_window_) | 44 if (root_window_) |
| 45 root_window_->RemoveObserver(this); | 45 root_window_->RemoveObserver(this); |
| 46 for (wm::WmWindow* window : windows_) | 46 for (WmWindow* window : windows_) |
| 47 window->RemoveObserver(this); | 47 window->RemoveObserver(this); |
| 48 root_window_->GetRootWindowController()->RemoveObserver(this); | 48 root_window_->GetRootWindowController()->RemoveObserver(this); |
| 49 globals_->RemoveActivationObserver(this); | 49 shell_->RemoveActivationObserver(this); |
| 50 } | 50 } |
| 51 | 51 |
| 52 void WorkspaceLayoutManager::DeleteDelegate() { | 52 void WorkspaceLayoutManager::DeleteDelegate() { |
| 53 delegate_.reset(); | 53 delegate_.reset(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void WorkspaceLayoutManager::SetMaximizeBackdropDelegate( | 56 void WorkspaceLayoutManager::SetMaximizeBackdropDelegate( |
| 57 std::unique_ptr<WorkspaceLayoutManagerBackdropDelegate> delegate) { | 57 std::unique_ptr<WorkspaceLayoutManagerBackdropDelegate> delegate) { |
| 58 backdrop_delegate_.reset(delegate.release()); | 58 backdrop_delegate_.reset(delegate.release()); |
| 59 } | 59 } |
| 60 | 60 |
| 61 ////////////////////////////////////////////////////////////////////////////// | 61 ////////////////////////////////////////////////////////////////////////////// |
| 62 // WorkspaceLayoutManager, aura::LayoutManager implementation: | 62 // WorkspaceLayoutManager, aura::LayoutManager implementation: |
| 63 | 63 |
| 64 void WorkspaceLayoutManager::OnWindowResized() {} | 64 void WorkspaceLayoutManager::OnWindowResized() {} |
| 65 | 65 |
| 66 void WorkspaceLayoutManager::OnWindowAddedToLayout(wm::WmWindow* child) { | 66 void WorkspaceLayoutManager::OnWindowAddedToLayout(WmWindow* child) { |
| 67 wm::WindowState* window_state = child->GetWindowState(); | 67 wm::WindowState* window_state = child->GetWindowState(); |
| 68 wm::WMEvent event(wm::WM_EVENT_ADDED_TO_WORKSPACE); | 68 wm::WMEvent event(wm::WM_EVENT_ADDED_TO_WORKSPACE); |
| 69 window_state->OnWMEvent(&event); | 69 window_state->OnWMEvent(&event); |
| 70 windows_.insert(child); | 70 windows_.insert(child); |
| 71 child->AddObserver(this); | 71 child->AddObserver(this); |
| 72 window_state->AddObserver(this); | 72 window_state->AddObserver(this); |
| 73 UpdateShelfVisibility(); | 73 UpdateShelfVisibility(); |
| 74 UpdateFullscreenState(); | 74 UpdateFullscreenState(); |
| 75 if (backdrop_delegate_) | 75 if (backdrop_delegate_) |
| 76 backdrop_delegate_->OnWindowAddedToLayout(child); | 76 backdrop_delegate_->OnWindowAddedToLayout(child); |
| 77 WindowPositioner::RearrangeVisibleWindowOnShow(child); | 77 WindowPositioner::RearrangeVisibleWindowOnShow(child); |
| 78 } | 78 } |
| 79 | 79 |
| 80 void WorkspaceLayoutManager::OnWillRemoveWindowFromLayout(wm::WmWindow* child) { | 80 void WorkspaceLayoutManager::OnWillRemoveWindowFromLayout(WmWindow* child) { |
| 81 windows_.erase(child); | 81 windows_.erase(child); |
| 82 child->RemoveObserver(this); | 82 child->RemoveObserver(this); |
| 83 child->GetWindowState()->RemoveObserver(this); | 83 child->GetWindowState()->RemoveObserver(this); |
| 84 | 84 |
| 85 if (child->GetTargetVisibility()) | 85 if (child->GetTargetVisibility()) |
| 86 WindowPositioner::RearrangeVisibleWindowOnHideOrRemove(child); | 86 WindowPositioner::RearrangeVisibleWindowOnHideOrRemove(child); |
| 87 } | 87 } |
| 88 | 88 |
| 89 void WorkspaceLayoutManager::OnWindowRemovedFromLayout(wm::WmWindow* child) { | 89 void WorkspaceLayoutManager::OnWindowRemovedFromLayout(WmWindow* child) { |
| 90 UpdateShelfVisibility(); | 90 UpdateShelfVisibility(); |
| 91 UpdateFullscreenState(); | 91 UpdateFullscreenState(); |
| 92 if (backdrop_delegate_) | 92 if (backdrop_delegate_) |
| 93 backdrop_delegate_->OnWindowRemovedFromLayout(child); | 93 backdrop_delegate_->OnWindowRemovedFromLayout(child); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void WorkspaceLayoutManager::OnChildWindowVisibilityChanged(wm::WmWindow* child, | 96 void WorkspaceLayoutManager::OnChildWindowVisibilityChanged(WmWindow* child, |
| 97 bool visible) { | 97 bool visible) { |
| 98 wm::WindowState* window_state = child->GetWindowState(); | 98 wm::WindowState* window_state = child->GetWindowState(); |
| 99 // Attempting to show a minimized window. Unminimize it. | 99 // Attempting to show a minimized window. Unminimize it. |
| 100 if (visible && window_state->IsMinimized()) | 100 if (visible && window_state->IsMinimized()) |
| 101 window_state->Unminimize(); | 101 window_state->Unminimize(); |
| 102 | 102 |
| 103 if (child->GetTargetVisibility()) | 103 if (child->GetTargetVisibility()) |
| 104 WindowPositioner::RearrangeVisibleWindowOnShow(child); | 104 WindowPositioner::RearrangeVisibleWindowOnShow(child); |
| 105 else | 105 else |
| 106 WindowPositioner::RearrangeVisibleWindowOnHideOrRemove(child); | 106 WindowPositioner::RearrangeVisibleWindowOnHideOrRemove(child); |
| 107 UpdateFullscreenState(); | 107 UpdateFullscreenState(); |
| 108 UpdateShelfVisibility(); | 108 UpdateShelfVisibility(); |
| 109 if (backdrop_delegate_) | 109 if (backdrop_delegate_) |
| 110 backdrop_delegate_->OnChildWindowVisibilityChanged(child, visible); | 110 backdrop_delegate_->OnChildWindowVisibilityChanged(child, visible); |
| 111 } | 111 } |
| 112 | 112 |
| 113 void WorkspaceLayoutManager::SetChildBounds(wm::WmWindow* child, | 113 void WorkspaceLayoutManager::SetChildBounds(WmWindow* child, |
| 114 const gfx::Rect& requested_bounds) { | 114 const gfx::Rect& requested_bounds) { |
| 115 wm::SetBoundsEvent event(wm::WM_EVENT_SET_BOUNDS, requested_bounds); | 115 wm::SetBoundsEvent event(wm::WM_EVENT_SET_BOUNDS, requested_bounds); |
| 116 child->GetWindowState()->OnWMEvent(&event); | 116 child->GetWindowState()->OnWMEvent(&event); |
| 117 UpdateShelfVisibility(); | 117 UpdateShelfVisibility(); |
| 118 } | 118 } |
| 119 | 119 |
| 120 ////////////////////////////////////////////////////////////////////////////// | 120 ////////////////////////////////////////////////////////////////////////////// |
| 121 // WorkspaceLayoutManager, keyboard::KeyboardControllerObserver implementation: | 121 // WorkspaceLayoutManager, keyboard::KeyboardControllerObserver implementation: |
| 122 | 122 |
| 123 void WorkspaceLayoutManager::OnKeyboardBoundsChanging( | 123 void WorkspaceLayoutManager::OnKeyboardBoundsChanging( |
| 124 const gfx::Rect& new_bounds) { | 124 const gfx::Rect& new_bounds) { |
| 125 wm::WmWindow* window = globals_->GetActiveWindow(); | 125 WmWindow* window = shell_->GetActiveWindow(); |
| 126 if (!window) | 126 if (!window) |
| 127 return; | 127 return; |
| 128 | 128 |
| 129 window = window->GetToplevelWindow(); | 129 window = window->GetToplevelWindow(); |
| 130 if (!window_->Contains(window)) | 130 if (!window_->Contains(window)) |
| 131 return; | 131 return; |
| 132 wm::WindowState* window_state = window->GetWindowState(); | 132 wm::WindowState* window_state = window->GetWindowState(); |
| 133 if (!new_bounds.IsEmpty()) { | 133 if (!new_bounds.IsEmpty()) { |
| 134 // Store existing bounds to be restored before resizing for keyboard if it | 134 // Store existing bounds to be restored before resizing for keyboard if it |
| 135 // is not already stored. | 135 // is not already stored. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 149 } else if (window_state->HasRestoreBounds()) { | 149 } else if (window_state->HasRestoreBounds()) { |
| 150 // Keyboard hidden, restore original bounds if they exist. If the user has | 150 // Keyboard hidden, restore original bounds if they exist. If the user has |
| 151 // resized or dragged the window in the meantime, WorkspaceWindowResizer | 151 // resized or dragged the window in the meantime, WorkspaceWindowResizer |
| 152 // will have cleared the restore bounds and this code will not accidentally | 152 // will have cleared the restore bounds and this code will not accidentally |
| 153 // override user intent. | 153 // override user intent. |
| 154 window_state->SetAndClearRestoreBounds(); | 154 window_state->SetAndClearRestoreBounds(); |
| 155 } | 155 } |
| 156 } | 156 } |
| 157 | 157 |
| 158 ////////////////////////////////////////////////////////////////////////////// | 158 ////////////////////////////////////////////////////////////////////////////// |
| 159 // WorkspaceLayoutManager, wm::WmRootWindowControllerObserver implementation: | 159 // WorkspaceLayoutManager, WmRootWindowControllerObserver implementation: |
| 160 | 160 |
| 161 void WorkspaceLayoutManager::OnWorkAreaChanged() { | 161 void WorkspaceLayoutManager::OnWorkAreaChanged() { |
| 162 const gfx::Rect work_area(wm::GetDisplayWorkAreaBounds(window_)); | 162 const gfx::Rect work_area(wm::GetDisplayWorkAreaBounds(window_)); |
| 163 if (work_area != work_area_in_parent_) { | 163 if (work_area != work_area_in_parent_) { |
| 164 const wm::WMEvent event(wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED); | 164 const wm::WMEvent event(wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED); |
| 165 AdjustAllWindowsBoundsForWorkAreaChange(&event); | 165 AdjustAllWindowsBoundsForWorkAreaChange(&event); |
| 166 } | 166 } |
| 167 if (backdrop_delegate_) | 167 if (backdrop_delegate_) |
| 168 backdrop_delegate_->OnDisplayWorkAreaInsetsChanged(); | 168 backdrop_delegate_->OnDisplayWorkAreaInsetsChanged(); |
| 169 } | 169 } |
| 170 | 170 |
| 171 void WorkspaceLayoutManager::OnFullscreenStateChanged(bool is_fullscreen) { | 171 void WorkspaceLayoutManager::OnFullscreenStateChanged(bool is_fullscreen) { |
| 172 if (is_fullscreen_ == is_fullscreen) | 172 if (is_fullscreen_ == is_fullscreen) |
| 173 return; | 173 return; |
| 174 | 174 |
| 175 is_fullscreen_ = is_fullscreen; | 175 is_fullscreen_ = is_fullscreen; |
| 176 wm::WmWindow* fullscreen_window = | 176 WmWindow* fullscreen_window = |
| 177 is_fullscreen ? GetWindowForFullscreenMode(window_) : nullptr; | 177 is_fullscreen ? wm::GetWindowForFullscreenMode(window_) : nullptr; |
| 178 // Changing always on top state may change window's parent. Iterate on a copy | 178 // Changing always on top state may change window's parent. Iterate on a copy |
| 179 // of |windows_| to avoid invalidating an iterator. Since both workspace and | 179 // of |windows_| to avoid invalidating an iterator. Since both workspace and |
| 180 // always_on_top containers' layouts are managed by this class all the | 180 // always_on_top containers' layouts are managed by this class all the |
| 181 // appropriate windows will be included in the iteration. | 181 // appropriate windows will be included in the iteration. |
| 182 WindowSet windows(windows_); | 182 WindowSet windows(windows_); |
| 183 for (auto window : windows) { | 183 for (auto window : windows) { |
| 184 wm::WindowState* window_state = window->GetWindowState(); | 184 wm::WindowState* window_state = window->GetWindowState(); |
| 185 if (is_fullscreen) | 185 if (is_fullscreen) |
| 186 window_state->DisableAlwaysOnTop(fullscreen_window); | 186 window_state->DisableAlwaysOnTop(fullscreen_window); |
| 187 else | 187 else |
| 188 window_state->RestoreAlwaysOnTop(); | 188 window_state->RestoreAlwaysOnTop(); |
| 189 } | 189 } |
| 190 } | 190 } |
| 191 | 191 |
| 192 ////////////////////////////////////////////////////////////////////////////// | 192 ////////////////////////////////////////////////////////////////////////////// |
| 193 // WorkspaceLayoutManager, aura::WindowObserver implementation: | 193 // WorkspaceLayoutManager, aura::WindowObserver implementation: |
| 194 | 194 |
| 195 void WorkspaceLayoutManager::OnWindowTreeChanged( | 195 void WorkspaceLayoutManager::OnWindowTreeChanged( |
| 196 wm::WmWindow* window, | 196 WmWindow* window, |
| 197 const wm::WmWindowObserver::TreeChangeParams& params) { | 197 const WmWindowObserver::TreeChangeParams& params) { |
| 198 if (!params.target->GetWindowState()->IsActive()) | 198 if (!params.target->GetWindowState()->IsActive()) |
| 199 return; | 199 return; |
| 200 // If the window is already tracked by the workspace this update would be | 200 // If the window is already tracked by the workspace this update would be |
| 201 // redundant as the fullscreen and shelf state would have been handled in | 201 // redundant as the fullscreen and shelf state would have been handled in |
| 202 // OnWindowAddedToLayout. | 202 // OnWindowAddedToLayout. |
| 203 if (windows_.find(params.target) != windows_.end()) | 203 if (windows_.find(params.target) != windows_.end()) |
| 204 return; | 204 return; |
| 205 | 205 |
| 206 // If the active window has moved to this root window then update the | 206 // If the active window has moved to this root window then update the |
| 207 // fullscreen state. | 207 // fullscreen state. |
| 208 // TODO(flackr): Track the active window leaving this root window and update | 208 // TODO(flackr): Track the active window leaving this root window and update |
| 209 // the fullscreen state accordingly. | 209 // the fullscreen state accordingly. |
| 210 if (params.new_parent && params.new_parent->GetRootWindow() == root_window_) { | 210 if (params.new_parent && params.new_parent->GetRootWindow() == root_window_) { |
| 211 UpdateFullscreenState(); | 211 UpdateFullscreenState(); |
| 212 UpdateShelfVisibility(); | 212 UpdateShelfVisibility(); |
| 213 } | 213 } |
| 214 } | 214 } |
| 215 | 215 |
| 216 void WorkspaceLayoutManager::OnWindowPropertyChanged( | 216 void WorkspaceLayoutManager::OnWindowPropertyChanged( |
| 217 wm::WmWindow* window, | 217 WmWindow* window, |
| 218 wm::WmWindowProperty property) { | 218 WmWindowProperty property) { |
| 219 if (property == wm::WmWindowProperty::ALWAYS_ON_TOP && | 219 if (property == WmWindowProperty::ALWAYS_ON_TOP && |
| 220 window->GetBoolProperty(wm::WmWindowProperty::ALWAYS_ON_TOP)) { | 220 window->GetBoolProperty(WmWindowProperty::ALWAYS_ON_TOP)) { |
| 221 root_window_controller_->GetAlwaysOnTopController() | 221 root_window_controller_->GetAlwaysOnTopController() |
| 222 ->GetContainer(window) | 222 ->GetContainer(window) |
| 223 ->AddChild(window); | 223 ->AddChild(window); |
| 224 } | 224 } |
| 225 } | 225 } |
| 226 | 226 |
| 227 void WorkspaceLayoutManager::OnWindowStackingChanged(wm::WmWindow* window) { | 227 void WorkspaceLayoutManager::OnWindowStackingChanged(WmWindow* window) { |
| 228 UpdateShelfVisibility(); | 228 UpdateShelfVisibility(); |
| 229 UpdateFullscreenState(); | 229 UpdateFullscreenState(); |
| 230 if (backdrop_delegate_) | 230 if (backdrop_delegate_) |
| 231 backdrop_delegate_->OnWindowStackingChanged(window); | 231 backdrop_delegate_->OnWindowStackingChanged(window); |
| 232 } | 232 } |
| 233 | 233 |
| 234 void WorkspaceLayoutManager::OnWindowDestroying(wm::WmWindow* window) { | 234 void WorkspaceLayoutManager::OnWindowDestroying(WmWindow* window) { |
| 235 if (root_window_ == window) { | 235 if (root_window_ == window) { |
| 236 root_window_->RemoveObserver(this); | 236 root_window_->RemoveObserver(this); |
| 237 root_window_ = nullptr; | 237 root_window_ = nullptr; |
| 238 } | 238 } |
| 239 } | 239 } |
| 240 | 240 |
| 241 void WorkspaceLayoutManager::OnWindowBoundsChanged( | 241 void WorkspaceLayoutManager::OnWindowBoundsChanged( |
| 242 wm::WmWindow* window, | 242 WmWindow* window, |
| 243 const gfx::Rect& old_bounds, | 243 const gfx::Rect& old_bounds, |
| 244 const gfx::Rect& new_bounds) { | 244 const gfx::Rect& new_bounds) { |
| 245 if (root_window_ == window) { | 245 if (root_window_ == window) { |
| 246 const wm::WMEvent wm_event(wm::WM_EVENT_DISPLAY_BOUNDS_CHANGED); | 246 const wm::WMEvent wm_event(wm::WM_EVENT_DISPLAY_BOUNDS_CHANGED); |
| 247 AdjustAllWindowsBoundsForWorkAreaChange(&wm_event); | 247 AdjustAllWindowsBoundsForWorkAreaChange(&wm_event); |
| 248 } | 248 } |
| 249 } | 249 } |
| 250 | 250 |
| 251 ////////////////////////////////////////////////////////////////////////////// | 251 ////////////////////////////////////////////////////////////////////////////// |
| 252 // WorkspaceLayoutManager, | 252 // WorkspaceLayoutManager, |
| 253 // aura::client::ActivationChangeObserver implementation: | 253 // aura::client::ActivationChangeObserver implementation: |
| 254 | 254 |
| 255 void WorkspaceLayoutManager::OnWindowActivated(wm::WmWindow* gained_active, | 255 void WorkspaceLayoutManager::OnWindowActivated(WmWindow* gained_active, |
| 256 wm::WmWindow* lost_active) { | 256 WmWindow* lost_active) { |
| 257 wm::WindowState* window_state = | 257 wm::WindowState* window_state = |
| 258 gained_active ? gained_active->GetWindowState() : nullptr; | 258 gained_active ? gained_active->GetWindowState() : nullptr; |
| 259 if (window_state && window_state->IsMinimized() && | 259 if (window_state && window_state->IsMinimized() && |
| 260 !gained_active->IsVisible()) { | 260 !gained_active->IsVisible()) { |
| 261 window_state->Unminimize(); | 261 window_state->Unminimize(); |
| 262 DCHECK(!window_state->IsMinimized()); | 262 DCHECK(!window_state->IsMinimized()); |
| 263 } | 263 } |
| 264 UpdateFullscreenState(); | 264 UpdateFullscreenState(); |
| 265 UpdateShelfVisibility(); | 265 UpdateShelfVisibility(); |
| 266 } | 266 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 289 const wm::WMEvent* event) { | 289 const wm::WMEvent* event) { |
| 290 DCHECK(event->type() == wm::WM_EVENT_DISPLAY_BOUNDS_CHANGED || | 290 DCHECK(event->type() == wm::WM_EVENT_DISPLAY_BOUNDS_CHANGED || |
| 291 event->type() == wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED); | 291 event->type() == wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED); |
| 292 | 292 |
| 293 work_area_in_parent_ = wm::GetDisplayWorkAreaBounds(window_); | 293 work_area_in_parent_ = wm::GetDisplayWorkAreaBounds(window_); |
| 294 | 294 |
| 295 // Don't do any adjustments of the insets while we are in screen locked mode. | 295 // Don't do any adjustments of the insets while we are in screen locked mode. |
| 296 // This would happen if the launcher was auto hidden before the login screen | 296 // This would happen if the launcher was auto hidden before the login screen |
| 297 // was shown and then gets shown when the login screen gets presented. | 297 // was shown and then gets shown when the login screen gets presented. |
| 298 if (event->type() == wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED && | 298 if (event->type() == wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED && |
| 299 globals_->IsScreenLocked()) | 299 shell_->IsScreenLocked()) |
| 300 return; | 300 return; |
| 301 | 301 |
| 302 // If a user plugs an external display into a laptop running Aura the | 302 // If a user plugs an external display into a laptop running Aura the |
| 303 // display size will change. Maximized windows need to resize to match. | 303 // display size will change. Maximized windows need to resize to match. |
| 304 // We also do this when developers running Aura on a desktop manually resize | 304 // We also do this when developers running Aura on a desktop manually resize |
| 305 // the host window. | 305 // the host window. |
| 306 // We also need to do this when the work area insets changes. | 306 // We also need to do this when the work area insets changes. |
| 307 for (wm::WmWindow* window : windows_) | 307 for (WmWindow* window : windows_) |
| 308 window->GetWindowState()->OnWMEvent(event); | 308 window->GetWindowState()->OnWMEvent(event); |
| 309 } | 309 } |
| 310 | 310 |
| 311 void WorkspaceLayoutManager::UpdateShelfVisibility() { | 311 void WorkspaceLayoutManager::UpdateShelfVisibility() { |
| 312 if (delegate_) | 312 if (delegate_) |
| 313 delegate_->UpdateShelfVisibility(); | 313 delegate_->UpdateShelfVisibility(); |
| 314 } | 314 } |
| 315 | 315 |
| 316 void WorkspaceLayoutManager::UpdateFullscreenState() { | 316 void WorkspaceLayoutManager::UpdateFullscreenState() { |
| 317 // TODO(flackr): The fullscreen state is currently tracked per workspace | 317 // TODO(flackr): The fullscreen state is currently tracked per workspace |
| 318 // but the shell notification implies a per root window state. Currently | 318 // but the shell notification implies a per root window state. Currently |
| 319 // only windows in the default workspace container will go fullscreen but | 319 // only windows in the default workspace container will go fullscreen but |
| 320 // this should really be tracked by the RootWindowController since | 320 // this should really be tracked by the RootWindowController since |
| 321 // technically any container could get a fullscreen window. | 321 // technically any container could get a fullscreen window. |
| 322 if (!delegate_) | 322 if (!delegate_) |
| 323 return; | 323 return; |
| 324 bool is_fullscreen = GetWindowForFullscreenMode(window_) != nullptr; | 324 bool is_fullscreen = wm::GetWindowForFullscreenMode(window_) != nullptr; |
| 325 if (is_fullscreen != is_fullscreen_) { | 325 if (is_fullscreen != is_fullscreen_) { |
| 326 delegate_->OnFullscreenStateChanged(is_fullscreen); | 326 delegate_->OnFullscreenStateChanged(is_fullscreen); |
| 327 is_fullscreen_ = is_fullscreen; | 327 is_fullscreen_ = is_fullscreen; |
| 328 } | 328 } |
| 329 } | 329 } |
| 330 | 330 |
| 331 } // namespace ash | 331 } // namespace ash |
| OLD | NEW |