| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/dock/docked_window_layout_manager.h" | 5 #include "ash/common/wm/dock/docked_window_layout_manager.h" |
| 6 | 6 |
| 7 #include "ash/animation/animation_change_type.h" | 7 #include "ash/animation/animation_change_type.h" |
| 8 #include "ash/common/shelf/shelf_background_animator.h" | 8 #include "ash/common/shelf/shelf_background_animator.h" |
| 9 #include "ash/common/shelf/shelf_background_animator_observer.h" | 9 #include "ash/common/shelf/shelf_background_animator_observer.h" |
| 10 #include "ash/common/shelf/shelf_constants.h" | 10 #include "ash/common/shelf/shelf_constants.h" |
| 11 #include "ash/common/shelf/wm_shelf.h" | 11 #include "ash/common/shelf/wm_shelf.h" |
| 12 #include "ash/common/shelf/wm_shelf_observer.h" | 12 #include "ash/common/shelf/wm_shelf_observer.h" |
| 13 #include "ash/common/wm/overview/window_selector_controller.h" | 13 #include "ash/common/wm/overview/window_selector_controller.h" |
| 14 #include "ash/common/wm/window_animation_types.h" | 14 #include "ash/common/wm/window_animation_types.h" |
| 15 #include "ash/common/wm/window_parenting_utils.h" | 15 #include "ash/common/wm/window_parenting_utils.h" |
| 16 #include "ash/common/wm/window_resizer.h" | 16 #include "ash/common/wm/window_resizer.h" |
| 17 #include "ash/common/wm/window_state.h" | 17 #include "ash/common/wm/window_state.h" |
| 18 #include "ash/common/wm_shell.h" | 18 #include "ash/common/wm_shell.h" |
| 19 #include "ash/common/wm_window.h" | 19 #include "ash/common/wm_window.h" |
| 20 #include "ash/public/cpp/shell_window_ids.h" | 20 #include "ash/public/cpp/shell_window_ids.h" |
| 21 #include "ash/resources/grit/ash_resources.h" | 21 #include "ash/resources/grit/ash_resources.h" |
| 22 #include "ash/root_window_controller.h" | 22 #include "ash/root_window_controller.h" |
| 23 #include "ash/shell.h" | 23 #include "ash/shell.h" |
| 24 #include "ash/wm/window_state_aura.h" | 24 #include "ash/wm/window_state_aura.h" |
| 25 #include "base/auto_reset.h" | 25 #include "base/auto_reset.h" |
| 26 #include "base/metrics/histogram_macros.h" | 26 #include "base/metrics/histogram_macros.h" |
| 27 #include "third_party/skia/include/core/SkColor.h" | 27 #include "third_party/skia/include/core/SkColor.h" |
| 28 #include "ui/aura/window.h" |
| 28 #include "ui/base/resource/resource_bundle.h" | 29 #include "ui/base/resource/resource_bundle.h" |
| 29 #include "ui/compositor/scoped_layer_animation_settings.h" | 30 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 30 #include "ui/display/display.h" | 31 #include "ui/display/display.h" |
| 31 #include "ui/display/screen.h" | 32 #include "ui/display/screen.h" |
| 32 #include "ui/views/background.h" | 33 #include "ui/views/background.h" |
| 33 #include "ui/wm/core/coordinate_conversion.h" | 34 #include "ui/wm/core/coordinate_conversion.h" |
| 34 #include "ui/wm/core/window_animations.h" | 35 #include "ui/wm/core/window_animations.h" |
| 35 #include "ui/wm/public/activation_client.h" | 36 #include "ui/wm/public/activation_client.h" |
| 36 | 37 |
| 37 namespace ash { | 38 namespace ash { |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 | 175 |
| 175 // Certain windows (minimized, hidden or popups) are not docked and are ignored | 176 // Certain windows (minimized, hidden or popups) are not docked and are ignored |
| 176 // by layout logic even when they are children of a docked container. | 177 // by layout logic even when they are children of a docked container. |
| 177 bool IsWindowDocked(const WmWindow* window) { | 178 bool IsWindowDocked(const WmWindow* window) { |
| 178 return (window->IsVisible() && !window->GetWindowState()->IsMinimized() && | 179 return (window->IsVisible() && !window->GetWindowState()->IsMinimized() && |
| 179 !IsPopupOrTransient(window)); | 180 !IsPopupOrTransient(window)); |
| 180 } | 181 } |
| 181 | 182 |
| 182 void UndockWindow(WmWindow* window) { | 183 void UndockWindow(WmWindow* window) { |
| 183 gfx::Rect previous_bounds = window->GetBounds(); | 184 gfx::Rect previous_bounds = window->GetBounds(); |
| 184 WmWindow* old_parent = window->GetParent(); | 185 aura::Window* old_parent = window->aura_window()->parent(); |
| 185 window->SetParentUsingContext(window, gfx::Rect()); | 186 window->SetParentUsingContext(window, gfx::Rect()); |
| 186 if (window->GetParent() != old_parent) { | 187 if (window->aura_window()->parent() != old_parent) { |
| 187 wm::ReparentTransientChildrenOfChild(window, old_parent, | 188 wm::ReparentTransientChildrenOfChild(window->aura_window(), old_parent, |
| 188 window->GetParent()); | 189 window->aura_window()->parent()); |
| 189 } | 190 } |
| 190 // Start maximize or fullscreen (affecting packaged apps) animation from | 191 // Start maximize or fullscreen (affecting packaged apps) animation from |
| 191 // previous window bounds. | 192 // previous window bounds. |
| 192 window->GetLayer()->SetBounds(previous_bounds); | 193 window->GetLayer()->SetBounds(previous_bounds); |
| 193 } | 194 } |
| 194 | 195 |
| 195 // Returns width that is as close as possible to |target_width| while being | 196 // Returns width that is as close as possible to |target_width| while being |
| 196 // consistent with docked min and max restrictions and respects the |window|'s | 197 // consistent with docked min and max restrictions and respects the |window|'s |
| 197 // minimum and maximum size. | 198 // minimum and maximum size. |
| 198 int GetWindowWidthCloseTo(const WmWindow* window, int target_width) { | 199 int GetWindowWidthCloseTo(const WmWindow* window, int target_width) { |
| (...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1332 const gfx::Rect& keyboard_bounds) { | 1333 const gfx::Rect& keyboard_bounds) { |
| 1333 // This bounds change will have caused a change to the Shelf which does not | 1334 // This bounds change will have caused a change to the Shelf which does not |
| 1334 // propagate automatically to this class, so manually recalculate bounds. | 1335 // propagate automatically to this class, so manually recalculate bounds. |
| 1335 Relayout(); | 1336 Relayout(); |
| 1336 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); | 1337 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); |
| 1337 } | 1338 } |
| 1338 | 1339 |
| 1339 void DockedWindowLayoutManager::OnKeyboardClosed() {} | 1340 void DockedWindowLayoutManager::OnKeyboardClosed() {} |
| 1340 | 1341 |
| 1341 } // namespace ash | 1342 } // namespace ash |
| OLD | NEW |