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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
211 intptr_t old) { | 211 intptr_t old) { |
212 if (key == aura::client::kAlwaysOnTopKey && | 212 if (key == aura::client::kAlwaysOnTopKey && |
213 window->GetProperty(aura::client::kAlwaysOnTopKey)) { | 213 window->GetProperty(aura::client::kAlwaysOnTopKey)) { |
214 GetRootWindowController(window->GetRootWindow())-> | 214 GetRootWindowController(window->GetRootWindow())-> |
215 always_on_top_controller()->GetContainer(window)->AddChild(window); | 215 always_on_top_controller()->GetContainer(window)->AddChild(window); |
216 } | 216 } |
217 } | 217 } |
218 | 218 |
219 void WorkspaceLayoutManager::OnWindowStackingChanged(aura::Window* window) { | 219 void WorkspaceLayoutManager::OnWindowStackingChanged(aura::Window* window) { |
220 UpdateShelfVisibility(); | 220 UpdateShelfVisibility(); |
221 UpdateFullscreenState(); | |
oshima
2014/02/14 20:09:30
I think this one should stay here. Technically it'
flackr
2014/02/14 20:15:01
Correct, but this calls OnWindowRemovedFromLayout
| |
222 } | 221 } |
223 | 222 |
224 void WorkspaceLayoutManager::OnWindowDestroying(aura::Window* window) { | 223 void WorkspaceLayoutManager::OnWindowDestroying(aura::Window* window) { |
225 if (root_window_ == window) { | 224 if (root_window_ == window) { |
226 root_window_->RemoveObserver(this); | 225 root_window_->RemoveObserver(this); |
227 root_window_ = NULL; | 226 root_window_ = NULL; |
228 } | 227 } |
229 } | 228 } |
230 | 229 |
231 void WorkspaceLayoutManager::OnWindowBoundsChanged(aura::Window* window, | 230 void WorkspaceLayoutManager::OnWindowBoundsChanged(aura::Window* window, |
232 const gfx::Rect& old_bounds, | 231 const gfx::Rect& old_bounds, |
233 const gfx::Rect& new_bounds) { | 232 const gfx::Rect& new_bounds) { |
234 if (root_window_ == window) | 233 if (root_window_ == window) |
235 AdjustAllWindowsBoundsForWorkAreaChange(ADJUST_WINDOW_DISPLAY_SIZE_CHANGED); | 234 AdjustAllWindowsBoundsForWorkAreaChange(ADJUST_WINDOW_DISPLAY_SIZE_CHANGED); |
236 } | 235 } |
237 | 236 |
238 ////////////////////////////////////////////////////////////////////////////// | 237 ////////////////////////////////////////////////////////////////////////////// |
239 // WorkspaceLayoutManager, | 238 // WorkspaceLayoutManager, |
240 // aura::client::ActivationChangeObserver implementation: | 239 // aura::client::ActivationChangeObserver implementation: |
241 | 240 |
242 void WorkspaceLayoutManager::OnWindowActivated(aura::Window* gained_active, | 241 void WorkspaceLayoutManager::OnWindowActivated(aura::Window* gained_active, |
243 aura::Window* lost_active) { | 242 aura::Window* lost_active) { |
oshima
2014/02/14 17:24:26
can you fix indent?
flackr
2014/02/14 20:00:02
Done.
| |
244 wm::WindowState* window_state = wm::GetWindowState(gained_active); | 243 wm::WindowState* window_state = wm::GetWindowState(gained_active); |
245 if (window_state && window_state->IsMinimized() && | 244 if (window_state && window_state->IsMinimized() && |
246 !gained_active->IsVisible()) { | 245 !gained_active->IsVisible()) { |
247 window_state->Unminimize(); | 246 window_state->Unminimize(); |
248 DCHECK(!window_state->IsMinimized()); | 247 DCHECK(!window_state->IsMinimized()); |
249 } | 248 } |
249 UpdateFullscreenState(); | |
oshima
2014/02/14 17:24:26
All layout managers are notified for activation ch
flackr
2014/02/14 20:00:02
Yes, since it's a ShellObserver notification, that
| |
250 } | 250 } |
251 | 251 |
252 ////////////////////////////////////////////////////////////////////////////// | 252 ////////////////////////////////////////////////////////////////////////////// |
253 // WorkspaceLayoutManager, wm::WindowStateObserver implementation: | 253 // WorkspaceLayoutManager, wm::WindowStateObserver implementation: |
254 | 254 |
255 void WorkspaceLayoutManager::OnWindowShowTypeChanged( | 255 void WorkspaceLayoutManager::OnWindowShowTypeChanged( |
256 wm::WindowState* window_state, | 256 wm::WindowState* window_state, |
257 wm::WindowShowType old_type) { | 257 wm::WindowShowType old_type) { |
258 if (old_type != wm::SHOW_TYPE_MINIMIZED && | 258 if (old_type != wm::SHOW_TYPE_MINIMIZED && |
259 !window_state->HasRestoreBounds() && | 259 !window_state->HasRestoreBounds() && |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
418 if (window->bounds() != bounds) | 418 if (window->bounds() != bounds) |
419 window->SetBounds(bounds); | 419 window->SetBounds(bounds); |
420 } | 420 } |
421 | 421 |
422 void WorkspaceLayoutManager::UpdateShelfVisibility() { | 422 void WorkspaceLayoutManager::UpdateShelfVisibility() { |
423 if (shelf_) | 423 if (shelf_) |
424 shelf_->UpdateVisibilityState(); | 424 shelf_->UpdateVisibilityState(); |
425 } | 425 } |
426 | 426 |
427 void WorkspaceLayoutManager::UpdateFullscreenState() { | 427 void WorkspaceLayoutManager::UpdateFullscreenState() { |
428 bool is_fullscreen = GetRootWindowController( | 428 const aura::Window* fullscreen_window = GetRootWindowController( |
429 window_->GetRootWindow())->GetWindowForFullscreenMode() != NULL; | 429 window_->GetRootWindow())->GetWindowForFullscreenMode(); |
430 // TODO(flackr): The fullscreen state is currently tracked per workspace | |
431 // but the shell notification implies a per root window state. Currently | |
432 // only windows in the default workspace container will go fullscreen so | |
433 // this should correctly track the root window fullscreen state but this | |
434 // should really be tracked by the RootWindowController since technically | |
435 // any container could get a fullscreen window. | |
436 bool is_fullscreen = fullscreen_window && | |
437 window_->Contains(fullscreen_window); | |
430 if (is_fullscreen != is_fullscreen_) { | 438 if (is_fullscreen != is_fullscreen_) { |
431 ash::Shell::GetInstance()->NotifyFullscreenStateChange( | 439 ash::Shell::GetInstance()->NotifyFullscreenStateChange( |
432 is_fullscreen, window_->GetRootWindow()); | 440 is_fullscreen, window_->GetRootWindow()); |
433 is_fullscreen_ = is_fullscreen; | 441 is_fullscreen_ = is_fullscreen; |
434 } | 442 } |
435 } | 443 } |
436 | 444 |
437 void WorkspaceLayoutManager::UpdateBoundsFromShowType( | 445 void WorkspaceLayoutManager::UpdateBoundsFromShowType( |
438 wm::WindowState* window_state, | 446 wm::WindowState* window_state, |
439 wm::WindowShowType old_show_type) { | 447 wm::WindowShowType old_show_type) { |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
536 ui::ScopedLayerAnimationSettings slide_settings(layer->GetAnimator()); | 544 ui::ScopedLayerAnimationSettings slide_settings(layer->GetAnimator()); |
537 slide_settings.SetPreemptionStrategy( | 545 slide_settings.SetPreemptionStrategy( |
538 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | 546 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); |
539 slide_settings.SetTransitionDuration( | 547 slide_settings.SetTransitionDuration( |
540 base::TimeDelta::FromMilliseconds(kBoundsChangeSlideDurationMs)); | 548 base::TimeDelta::FromMilliseconds(kBoundsChangeSlideDurationMs)); |
541 SetChildBoundsDirect(child, bounds); | 549 SetChildBoundsDirect(child, bounds); |
542 } | 550 } |
543 | 551 |
544 } // namespace internal | 552 } // namespace internal |
545 } // namespace ash | 553 } // namespace ash |
OLD | NEW |