| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
| 10 #include "ash/screen_util.h" | 10 #include "ash/screen_util.h" |
| 11 #include "ash/session/session_state_delegate.h" | 11 #include "ash/session/session_state_delegate.h" |
| 12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
| 13 #include "ash/wm/always_on_top_controller.h" | 13 #include "ash/wm/always_on_top_controller.h" |
| 14 #include "ash/wm/aura/wm_window_aura.h" |
| 14 #include "ash/wm/common/wm_event.h" | 15 #include "ash/wm/common/wm_event.h" |
| 15 #include "ash/wm/common/workspace/workspace_layout_manager_delegate.h" | 16 #include "ash/wm/common/workspace/workspace_layout_manager_delegate.h" |
| 16 #include "ash/wm/window_animations.h" | 17 #include "ash/wm/window_animations.h" |
| 17 #include "ash/wm/window_positioner.h" | 18 #include "ash/wm/window_positioner.h" |
| 18 #include "ash/wm/window_properties.h" | 19 #include "ash/wm/window_properties.h" |
| 19 #include "ash/wm/window_state.h" | 20 #include "ash/wm/window_state.h" |
| 20 #include "ash/wm/window_state_aura.h" | 21 #include "ash/wm/window_state_aura.h" |
| 21 #include "ash/wm/window_util.h" | 22 #include "ash/wm/window_util.h" |
| 22 #include "ash/wm/workspace/workspace_layout_manager_backdrop_delegate.h" | 23 #include "ash/wm/workspace/workspace_layout_manager_backdrop_delegate.h" |
| 23 #include "ui/aura/client/aura_constants.h" | 24 #include "ui/aura/client/aura_constants.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 wm::WindowState* window_state = wm::GetWindowState(child); | 80 wm::WindowState* window_state = wm::GetWindowState(child); |
| 80 wm::WMEvent event(wm::WM_EVENT_ADDED_TO_WORKSPACE); | 81 wm::WMEvent event(wm::WM_EVENT_ADDED_TO_WORKSPACE); |
| 81 window_state->OnWMEvent(&event); | 82 window_state->OnWMEvent(&event); |
| 82 windows_.insert(child); | 83 windows_.insert(child); |
| 83 child->AddObserver(this); | 84 child->AddObserver(this); |
| 84 window_state->AddObserver(this); | 85 window_state->AddObserver(this); |
| 85 UpdateShelfVisibility(); | 86 UpdateShelfVisibility(); |
| 86 UpdateFullscreenState(); | 87 UpdateFullscreenState(); |
| 87 if (backdrop_delegate_) | 88 if (backdrop_delegate_) |
| 88 backdrop_delegate_->OnWindowAddedToLayout(child); | 89 backdrop_delegate_->OnWindowAddedToLayout(child); |
| 89 WindowPositioner::RearrangeVisibleWindowOnShow(child); | 90 WindowPositioner::RearrangeVisibleWindowOnShow(wm::WmWindowAura::Get(child)); |
| 90 } | 91 } |
| 91 | 92 |
| 92 void WorkspaceLayoutManager::OnWillRemoveWindowFromLayout(Window* child) { | 93 void WorkspaceLayoutManager::OnWillRemoveWindowFromLayout(Window* child) { |
| 93 windows_.erase(child); | 94 windows_.erase(child); |
| 94 child->RemoveObserver(this); | 95 child->RemoveObserver(this); |
| 95 wm::GetWindowState(child)->RemoveObserver(this); | 96 wm::GetWindowState(child)->RemoveObserver(this); |
| 96 | 97 |
| 97 if (child->TargetVisibility()) | 98 if (child->TargetVisibility()) { |
| 98 WindowPositioner::RearrangeVisibleWindowOnHideOrRemove(child); | 99 WindowPositioner::RearrangeVisibleWindowOnHideOrRemove( |
| 100 wm::WmWindowAura::Get(child)); |
| 101 } |
| 99 } | 102 } |
| 100 | 103 |
| 101 void WorkspaceLayoutManager::OnWindowRemovedFromLayout(Window* child) { | 104 void WorkspaceLayoutManager::OnWindowRemovedFromLayout(Window* child) { |
| 102 UpdateShelfVisibility(); | 105 UpdateShelfVisibility(); |
| 103 UpdateFullscreenState(); | 106 UpdateFullscreenState(); |
| 104 if (backdrop_delegate_) | 107 if (backdrop_delegate_) |
| 105 backdrop_delegate_->OnWindowRemovedFromLayout(child); | 108 backdrop_delegate_->OnWindowRemovedFromLayout(child); |
| 106 } | 109 } |
| 107 | 110 |
| 108 void WorkspaceLayoutManager::OnChildWindowVisibilityChanged(Window* child, | 111 void WorkspaceLayoutManager::OnChildWindowVisibilityChanged(Window* child, |
| 109 bool visible) { | 112 bool visible) { |
| 110 wm::WindowState* window_state = wm::GetWindowState(child); | 113 wm::WindowState* window_state = wm::GetWindowState(child); |
| 111 // Attempting to show a minimized window. Unminimize it. | 114 // Attempting to show a minimized window. Unminimize it. |
| 112 if (visible && window_state->IsMinimized()) | 115 if (visible && window_state->IsMinimized()) |
| 113 window_state->Unminimize(); | 116 window_state->Unminimize(); |
| 114 | 117 |
| 115 if (child->TargetVisibility()) | 118 if (child->TargetVisibility()) { |
| 116 WindowPositioner::RearrangeVisibleWindowOnShow(child); | 119 WindowPositioner::RearrangeVisibleWindowOnShow( |
| 117 else | 120 wm::WmWindowAura::Get(child)); |
| 118 WindowPositioner::RearrangeVisibleWindowOnHideOrRemove(child); | 121 } else { |
| 122 WindowPositioner::RearrangeVisibleWindowOnHideOrRemove( |
| 123 wm::WmWindowAura::Get(child)); |
| 124 } |
| 119 UpdateFullscreenState(); | 125 UpdateFullscreenState(); |
| 120 UpdateShelfVisibility(); | 126 UpdateShelfVisibility(); |
| 121 if (backdrop_delegate_) | 127 if (backdrop_delegate_) |
| 122 backdrop_delegate_->OnChildWindowVisibilityChanged(child, visible); | 128 backdrop_delegate_->OnChildWindowVisibilityChanged(child, visible); |
| 123 } | 129 } |
| 124 | 130 |
| 125 void WorkspaceLayoutManager::SetChildBounds( | 131 void WorkspaceLayoutManager::SetChildBounds( |
| 126 Window* child, | 132 Window* child, |
| 127 const gfx::Rect& requested_bounds) { | 133 const gfx::Rect& requested_bounds) { |
| 128 wm::WindowState* window_state = wm::GetWindowState(child); | 134 wm::WindowState* window_state = wm::GetWindowState(child); |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 return; | 354 return; |
| 349 bool is_fullscreen = GetRootWindowController( | 355 bool is_fullscreen = GetRootWindowController( |
| 350 window_->GetRootWindow())->GetWindowForFullscreenMode() != NULL; | 356 window_->GetRootWindow())->GetWindowForFullscreenMode() != NULL; |
| 351 if (is_fullscreen != is_fullscreen_) { | 357 if (is_fullscreen != is_fullscreen_) { |
| 352 delegate_->OnFullscreenStateChanged(is_fullscreen); | 358 delegate_->OnFullscreenStateChanged(is_fullscreen); |
| 353 is_fullscreen_ = is_fullscreen; | 359 is_fullscreen_ = is_fullscreen; |
| 354 } | 360 } |
| 355 } | 361 } |
| 356 | 362 |
| 357 } // namespace ash | 363 } // namespace ash |
| OLD | NEW |