Chromium Code Reviews| 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/workspace_layout_manager.h" | 5 #include "ash/wm/workspace/workspace_layout_manager.h" |
| 6 | 6 |
| 7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
| 8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
| 9 #include "ash/screen_util.h" | 9 #include "ash/screen_util.h" |
| 10 #include "ash/session_state_delegate.h" | 10 #include "ash/session_state_delegate.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 149 Shell::GetScreen()->GetDisplayNearestWindow(window_).work_area())); | 149 Shell::GetScreen()->GetDisplayNearestWindow(window_).work_area())); |
| 150 if (work_area != work_area_in_parent_) { | 150 if (work_area != work_area_in_parent_) { |
| 151 AdjustAllWindowsBoundsForWorkAreaChange( | 151 AdjustAllWindowsBoundsForWorkAreaChange( |
| 152 ADJUST_WINDOW_WORK_AREA_INSETS_CHANGED); | 152 ADJUST_WINDOW_WORK_AREA_INSETS_CHANGED); |
| 153 } | 153 } |
| 154 } | 154 } |
| 155 | 155 |
| 156 ////////////////////////////////////////////////////////////////////////////// | 156 ////////////////////////////////////////////////////////////////////////////// |
| 157 // WorkspaceLayoutManager, aura::WindowObserver implementation: | 157 // WorkspaceLayoutManager, aura::WindowObserver implementation: |
| 158 | 158 |
| 159 void WorkspaceLayoutManager::OnWindowHierarchyChanged( | |
| 160 const WindowObserver::HierarchyChangeParams& params) { | |
|
oshima
2014/02/21 19:49:46
A display may become fullscreen when the fullscree
flackr
2014/02/24 16:21:10
Yes, if an active window (i.e. panel) is preventin
| |
| 161 if (!wm::GetWindowState(params.target)->IsActive()) | |
| 162 return; | |
| 163 // If the window is already tracked by the workspace this update would be | |
| 164 // redundant as the fullscreen and shelf state would have been handled in | |
| 165 // OnWindowAddedToLayout. | |
| 166 if (windows_.find(params.target) != windows_.end()) | |
| 167 return; | |
| 168 | |
| 169 // If the active window has moved to this root window then update the | |
| 170 // fullscreen state. | |
| 171 // TODO(flackr): Track the active window leaving this root window and update | |
| 172 // the fullscreen state accordingly. | |
| 173 if (params.new_parent && params.new_parent->GetRootWindow() == root_window_) { | |
| 174 UpdateFullscreenState(); | |
| 175 UpdateShelfVisibility(); | |
| 176 } | |
| 177 } | |
| 178 | |
| 159 void WorkspaceLayoutManager::OnWindowPropertyChanged(Window* window, | 179 void WorkspaceLayoutManager::OnWindowPropertyChanged(Window* window, |
| 160 const void* key, | 180 const void* key, |
| 161 intptr_t old) { | 181 intptr_t old) { |
| 162 if (key == aura::client::kAlwaysOnTopKey && | 182 if (key == aura::client::kAlwaysOnTopKey && |
| 163 window->GetProperty(aura::client::kAlwaysOnTopKey)) { | 183 window->GetProperty(aura::client::kAlwaysOnTopKey)) { |
| 164 GetRootWindowController(window->GetRootWindow())-> | 184 GetRootWindowController(window->GetRootWindow())-> |
| 165 always_on_top_controller()->GetContainer(window)->AddChild(window); | 185 always_on_top_controller()->GetContainer(window)->AddChild(window); |
| 166 } | 186 } |
| 167 } | 187 } |
| 168 | 188 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 183 const gfx::Rect& new_bounds) { | 203 const gfx::Rect& new_bounds) { |
| 184 if (root_window_ == window) | 204 if (root_window_ == window) |
| 185 AdjustAllWindowsBoundsForWorkAreaChange(ADJUST_WINDOW_DISPLAY_SIZE_CHANGED); | 205 AdjustAllWindowsBoundsForWorkAreaChange(ADJUST_WINDOW_DISPLAY_SIZE_CHANGED); |
| 186 } | 206 } |
| 187 | 207 |
| 188 ////////////////////////////////////////////////////////////////////////////// | 208 ////////////////////////////////////////////////////////////////////////////// |
| 189 // WorkspaceLayoutManager, | 209 // WorkspaceLayoutManager, |
| 190 // aura::client::ActivationChangeObserver implementation: | 210 // aura::client::ActivationChangeObserver implementation: |
| 191 | 211 |
| 192 void WorkspaceLayoutManager::OnWindowActivated(aura::Window* gained_active, | 212 void WorkspaceLayoutManager::OnWindowActivated(aura::Window* gained_active, |
| 193 aura::Window* lost_active) { | 213 aura::Window* lost_active) { |
| 194 wm::WindowState* window_state = wm::GetWindowState(gained_active); | 214 wm::WindowState* window_state = wm::GetWindowState(gained_active); |
| 195 if (window_state && window_state->IsMinimized() && | 215 if (window_state && window_state->IsMinimized() && |
| 196 !gained_active->IsVisible()) { | 216 !gained_active->IsVisible()) { |
| 197 window_state->Unminimize(); | 217 window_state->Unminimize(); |
| 198 DCHECK(!window_state->IsMinimized()); | 218 DCHECK(!window_state->IsMinimized()); |
| 199 } | 219 } |
| 220 UpdateFullscreenState(); | |
| 200 } | 221 } |
| 201 | 222 |
| 202 ////////////////////////////////////////////////////////////////////////////// | 223 ////////////////////////////////////////////////////////////////////////////// |
| 203 // WorkspaceLayoutManager, wm::WindowStateObserver implementation: | 224 // WorkspaceLayoutManager, wm::WindowStateObserver implementation: |
| 204 | 225 |
| 205 void WorkspaceLayoutManager::OnPostWindowShowTypeChange( | 226 void WorkspaceLayoutManager::OnPostWindowShowTypeChange( |
| 206 wm::WindowState* window_state, | 227 wm::WindowState* window_state, |
| 207 wm::WindowShowType old_type) { | 228 wm::WindowShowType old_type) { |
| 208 | 229 |
| 209 // Notify observers that fullscreen state may be changing. | 230 // Notify observers that fullscreen state may be changing. |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 309 if (window->bounds() != bounds) | 330 if (window->bounds() != bounds) |
| 310 window->SetBounds(bounds); | 331 window->SetBounds(bounds); |
| 311 } | 332 } |
| 312 | 333 |
| 313 void WorkspaceLayoutManager::UpdateShelfVisibility() { | 334 void WorkspaceLayoutManager::UpdateShelfVisibility() { |
| 314 if (shelf_) | 335 if (shelf_) |
| 315 shelf_->UpdateVisibilityState(); | 336 shelf_->UpdateVisibilityState(); |
| 316 } | 337 } |
| 317 | 338 |
| 318 void WorkspaceLayoutManager::UpdateFullscreenState() { | 339 void WorkspaceLayoutManager::UpdateFullscreenState() { |
| 340 // TODO(flackr): The fullscreen state is currently tracked per workspace | |
| 341 // but the shell notification implies a per root window state. Currently | |
| 342 // only windows in the default workspace container will go fullscreen but | |
| 343 // this should really be tracked by the RootWindowController since | |
| 344 // technically any container could get a fullscreen window. | |
| 345 if (!shelf_) | |
| 346 return; | |
| 319 bool is_fullscreen = GetRootWindowController( | 347 bool is_fullscreen = GetRootWindowController( |
| 320 window_->GetRootWindow())->GetWindowForFullscreenMode() != NULL; | 348 window_->GetRootWindow())->GetWindowForFullscreenMode() != NULL; |
| 321 if (is_fullscreen != is_fullscreen_) { | 349 if (is_fullscreen != is_fullscreen_) { |
| 322 ash::Shell::GetInstance()->NotifyFullscreenStateChange( | 350 ash::Shell::GetInstance()->NotifyFullscreenStateChange( |
| 323 is_fullscreen, window_->GetRootWindow()); | 351 is_fullscreen, window_->GetRootWindow()); |
| 324 is_fullscreen_ = is_fullscreen; | 352 is_fullscreen_ = is_fullscreen; |
| 325 } | 353 } |
| 326 } | 354 } |
| 327 | 355 |
| 328 bool WorkspaceLayoutManager::SetMaximizedOrFullscreenBounds( | 356 bool WorkspaceLayoutManager::SetMaximizedOrFullscreenBounds( |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 339 SetChildBoundsDirect( | 367 SetChildBoundsDirect( |
| 340 window_state->window(), | 368 window_state->window(), |
| 341 ScreenUtil::GetDisplayBoundsInParent(window_state->window())); | 369 ScreenUtil::GetDisplayBoundsInParent(window_state->window())); |
| 342 return true; | 370 return true; |
| 343 } | 371 } |
| 344 return false; | 372 return false; |
| 345 } | 373 } |
| 346 | 374 |
| 347 } // namespace internal | 375 } // namespace internal |
| 348 } // namespace ash | 376 } // namespace ash |
| OLD | NEW |