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/wm/dock/docked_window_layout_manager.h" | 5 #include "ash/wm/dock/docked_window_layout_manager.h" |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/launcher/launcher.h" | 8 #include "ash/launcher/launcher.h" |
9 #include "ash/screen_ash.h" | 9 #include "ash/screen_ash.h" |
10 #include "ash/shelf/shelf_layout_manager.h" | 10 #include "ash/shelf/shelf_layout_manager.h" |
11 #include "ash/shelf/shelf_types.h" | 11 #include "ash/shelf/shelf_types.h" |
12 #include "ash/shelf/shelf_widget.h" | 12 #include "ash/shelf/shelf_widget.h" |
13 #include "ash/shell.h" | 13 #include "ash/shell.h" |
14 #include "ash/shell_window_ids.h" | 14 #include "ash/shell_window_ids.h" |
15 #include "ash/wm/coordinate_conversion.h" | 15 #include "ash/wm/coordinate_conversion.h" |
16 #include "ash/wm/window_animations.h" | 16 #include "ash/wm/window_animations.h" |
17 #include "ash/wm/window_properties.h" | 17 #include "ash/wm/window_properties.h" |
18 #include "ash/wm/window_state.h" | 18 #include "ash/wm/window_state.h" |
19 #include "ash/wm/window_util.h" | 19 #include "ash/wm/window_util.h" |
20 #include "ash/wm/workspace_controller.h" | 20 #include "ash/wm/workspace_controller.h" |
21 #include "base/auto_reset.h" | 21 #include "base/auto_reset.h" |
22 #include "base/command_line.h" | 22 #include "base/command_line.h" |
23 #include "third_party/skia/include/core/SkColor.h" | 23 #include "third_party/skia/include/core/SkColor.h" |
24 #include "ui/aura/client/activation_client.h" | 24 #include "ui/aura/client/activation_client.h" |
25 #include "ui/aura/client/focus_client.h" | 25 #include "ui/aura/client/focus_client.h" |
| 26 #include "ui/aura/client/window_tree_client.h" |
26 #include "ui/aura/root_window.h" | 27 #include "ui/aura/root_window.h" |
27 #include "ui/aura/window.h" | 28 #include "ui/aura/window.h" |
28 #include "ui/aura/window_delegate.h" | 29 #include "ui/aura/window_delegate.h" |
29 #include "ui/compositor/scoped_layer_animation_settings.h" | 30 #include "ui/compositor/scoped_layer_animation_settings.h" |
30 #include "ui/gfx/rect.h" | 31 #include "ui/gfx/rect.h" |
31 | 32 |
32 namespace ash { | 33 namespace ash { |
33 namespace internal { | 34 namespace internal { |
34 | 35 |
35 // Minimum, maximum width of the dock area and a width of the gap | 36 // Minimum, maximum width of the dock area and a width of the gap |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 } | 105 } |
105 | 106 |
106 void UndockWindow(aura::Window* window) { | 107 void UndockWindow(aura::Window* window) { |
107 aura::Window* focused = | 108 aura::Window* focused = |
108 aura::client::GetFocusClient(window)->GetFocusedWindow(); | 109 aura::client::GetFocusClient(window)->GetFocusedWindow(); |
109 bool had_focus = window == focused || window->Contains(focused); | 110 bool had_focus = window == focused || window->Contains(focused); |
110 window->Hide(); | 111 window->Hide(); |
111 window->layer()->GetAnimator()->StopAnimating(); | 112 window->layer()->GetAnimator()->StopAnimating(); |
112 gfx::Rect previous_bounds = window->bounds(); | 113 gfx::Rect previous_bounds = window->bounds(); |
113 aura::Window* previous_parent = window->parent(); | 114 aura::Window* previous_parent = window->parent(); |
114 window->SetDefaultParentByRootWindow(window->GetRootWindow(), gfx::Rect()); | 115 aura::client::ParentWindowWithContext(window, window, gfx::Rect()); |
115 if (window->parent() != previous_parent) | 116 if (window->parent() != previous_parent) |
116 wm::ReparentTransientChildrenOfChild(window->parent(), window); | 117 wm::ReparentTransientChildrenOfChild(window->parent(), window); |
117 // Animate maximize animation from previous window bounds. | 118 // Animate maximize animation from previous window bounds. |
118 if (wm::GetWindowState(window)->IsMaximized()) | 119 if (wm::GetWindowState(window)->IsMaximized()) |
119 window->layer()->SetBounds(previous_bounds); | 120 window->layer()->SetBounds(previous_bounds); |
120 window->Show(); | 121 window->Show(); |
121 // Restore focus if the window had it before. | 122 // Restore focus if the window had it before. |
122 if (had_focus && !wm::GetWindowState(window)->IsFullscreen()) | 123 if (had_focus && !wm::GetWindowState(window)->IsFullscreen()) |
123 focused->Focus(); | 124 focused->Focus(); |
124 } | 125 } |
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1021 void DockedWindowLayoutManager::OnKeyboardBoundsChanging( | 1022 void DockedWindowLayoutManager::OnKeyboardBoundsChanging( |
1022 const gfx::Rect& keyboard_bounds) { | 1023 const gfx::Rect& keyboard_bounds) { |
1023 // This bounds change will have caused a change to the Shelf which does not | 1024 // This bounds change will have caused a change to the Shelf which does not |
1024 // propagate automatically to this class, so manually recalculate bounds. | 1025 // propagate automatically to this class, so manually recalculate bounds. |
1025 Relayout(); | 1026 Relayout(); |
1026 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); | 1027 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); |
1027 } | 1028 } |
1028 | 1029 |
1029 } // namespace internal | 1030 } // namespace internal |
1030 } // namespace ash | 1031 } // namespace ash |
OLD | NEW |