| 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/screen_util.h" | 7 #include "ash/screen_util.h" |
| 8 #include "ash/shelf/shelf.h" | 8 #include "ash/shelf/shelf.h" |
| 9 #include "ash/shelf/shelf_constants.h" | 9 #include "ash/shelf/shelf_constants.h" |
| 10 #include "ash/shelf/shelf_layout_manager.h" | 10 #include "ash/shelf/shelf_layout_manager.h" |
| 11 #include "ash/shelf/shelf_layout_manager_observer.h" | 11 #include "ash/shelf/shelf_layout_manager_observer.h" |
| 12 #include "ash/shelf/shelf_types.h" | 12 #include "ash/shelf/shelf_types.h" |
| 13 #include "ash/shelf/shelf_widget.h" | 13 #include "ash/shelf/shelf_widget.h" |
| 14 #include "ash/shell.h" | 14 #include "ash/shell.h" |
| 15 #include "ash/shell_window_ids.h" | 15 #include "ash/shell_window_ids.h" |
| 16 #include "ash/wm/coordinate_conversion.h" | 16 #include "ash/wm/coordinate_conversion.h" |
| 17 #include "ash/wm/window_animations.h" | 17 #include "ash/wm/window_animations.h" |
| 18 #include "ash/wm/window_properties.h" | 18 #include "ash/wm/window_properties.h" |
| 19 #include "ash/wm/window_resizer.h" | 19 #include "ash/wm/window_resizer.h" |
| 20 #include "ash/wm/window_state.h" | 20 #include "ash/wm/window_state.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_controller.h" | 23 #include "ash/wm/workspace_controller.h" |
| 23 #include "base/auto_reset.h" | 24 #include "base/auto_reset.h" |
| 24 #include "base/command_line.h" | 25 #include "base/command_line.h" |
| 25 #include "base/metrics/histogram.h" | 26 #include "base/metrics/histogram.h" |
| 26 #include "grit/ash_resources.h" | 27 #include "grit/ash_resources.h" |
| 27 #include "third_party/skia/include/core/SkColor.h" | 28 #include "third_party/skia/include/core/SkColor.h" |
| 28 #include "third_party/skia/include/core/SkPaint.h" | 29 #include "third_party/skia/include/core/SkPaint.h" |
| 29 #include "ui/aura/client/focus_client.h" | 30 #include "ui/aura/client/focus_client.h" |
| 30 #include "ui/aura/client/window_tree_client.h" | 31 #include "ui/aura/client/window_tree_client.h" |
| (...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 Relayout(); | 832 Relayout(); |
| 832 UpdateDockBounds(DockedWindowLayoutManagerObserver::SHELF_ALIGNMENT_CHANGED); | 833 UpdateDockBounds(DockedWindowLayoutManagerObserver::SHELF_ALIGNMENT_CHANGED); |
| 833 } | 834 } |
| 834 | 835 |
| 835 ///////////////////////////////////////////////////////////////////////////// | 836 ///////////////////////////////////////////////////////////////////////////// |
| 836 // DockedWindowLayoutManager, WindowStateObserver implementation: | 837 // DockedWindowLayoutManager, WindowStateObserver implementation: |
| 837 | 838 |
| 838 void DockedWindowLayoutManager::OnPreWindowStateTypeChange( | 839 void DockedWindowLayoutManager::OnPreWindowStateTypeChange( |
| 839 wm::WindowState* window_state, | 840 wm::WindowState* window_state, |
| 840 wm::WindowStateType old_type) { | 841 wm::WindowStateType old_type) { |
| 841 aura::Window* window = window_state->window(); | 842 aura::Window* window = window_state->aura_window(); |
| 842 if (IsPopupOrTransient(window)) | 843 if (IsPopupOrTransient(window)) |
| 843 return; | 844 return; |
| 844 // The window property will still be set, but no actual change will occur | 845 // The window property will still be set, but no actual change will occur |
| 845 // until OnFullscreenStateChange is called when exiting fullscreen. | 846 // until OnFullscreenStateChange is called when exiting fullscreen. |
| 846 if (in_fullscreen_) | 847 if (in_fullscreen_) |
| 847 return; | 848 return; |
| 848 if (!window_state->IsDocked()) { | 849 if (!window_state->IsDocked()) { |
| 849 if (window != dragged_window_) { | 850 if (window != dragged_window_) { |
| 850 UndockWindow(window); | 851 UndockWindow(window); |
| 851 if (window_state->IsMaximizedOrFullscreen()) | 852 if (window_state->IsMaximizedOrFullscreen()) |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 settings.SetTransitionDuration( | 956 settings.SetTransitionDuration( |
| 956 base::TimeDelta::FromMilliseconds(kMinimizeDurationMs)); | 957 base::TimeDelta::FromMilliseconds(kMinimizeDurationMs)); |
| 957 settings.LockTransitionDuration(); | 958 settings.LockTransitionDuration(); |
| 958 wm::GetWindowState(window)->Minimize(); | 959 wm::GetWindowState(window)->Minimize(); |
| 959 } | 960 } |
| 960 } | 961 } |
| 961 } | 962 } |
| 962 | 963 |
| 963 void DockedWindowLayoutManager::MinimizeDockedWindow( | 964 void DockedWindowLayoutManager::MinimizeDockedWindow( |
| 964 wm::WindowState* window_state) { | 965 wm::WindowState* window_state) { |
| 965 DCHECK(!IsPopupOrTransient(window_state->window())); | 966 DCHECK(!IsPopupOrTransient(window_state->aura_window())); |
| 966 window_state->window()->Hide(); | 967 window_state->window()->Hide(); |
| 967 if (window_state->IsActive()) | 968 if (window_state->IsActive()) |
| 968 window_state->Deactivate(); | 969 window_state->Deactivate(); |
| 969 RecordUmaAction(DOCKED_ACTION_MINIMIZE, event_source_); | 970 RecordUmaAction(DOCKED_ACTION_MINIMIZE, event_source_); |
| 970 } | 971 } |
| 971 | 972 |
| 972 void DockedWindowLayoutManager::RestoreDockedWindow( | 973 void DockedWindowLayoutManager::RestoreDockedWindow( |
| 973 wm::WindowState* window_state) { | 974 wm::WindowState* window_state) { |
| 974 aura::Window* window = window_state->window(); | 975 aura::Window* window = window_state->aura_window(); |
| 975 DCHECK(!IsPopupOrTransient(window)); | 976 DCHECK(!IsPopupOrTransient(window)); |
| 976 // Always place restored window at the bottom shuffling the other windows up. | 977 // Always place restored window at the bottom shuffling the other windows up. |
| 977 // TODO(varkha): add a separate container for docked windows to keep track | 978 // TODO(varkha): add a separate container for docked windows to keep track |
| 978 // of ordering. | 979 // of ordering. |
| 979 gfx::Display display = | 980 gfx::Display display = |
| 980 gfx::Screen::GetScreen()->GetDisplayNearestWindow(dock_container_); | 981 gfx::Screen::GetScreen()->GetDisplayNearestWindow(dock_container_); |
| 981 const gfx::Rect work_area = display.work_area(); | 982 const gfx::Rect work_area = display.work_area(); |
| 982 | 983 |
| 983 // Evict the window if it can no longer be docked because of its height. | 984 // Evict the window if it can no longer be docked because of its height. |
| 984 if (!CanDockWindow(window, DOCKED_ALIGNMENT_NONE)) { | 985 if (!CanDockWindow(window, DOCKED_ALIGNMENT_NONE)) { |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1364 | 1365 |
| 1365 void DockedWindowLayoutManager::OnKeyboardBoundsChanging( | 1366 void DockedWindowLayoutManager::OnKeyboardBoundsChanging( |
| 1366 const gfx::Rect& keyboard_bounds) { | 1367 const gfx::Rect& keyboard_bounds) { |
| 1367 // This bounds change will have caused a change to the Shelf which does not | 1368 // This bounds change will have caused a change to the Shelf which does not |
| 1368 // propagate automatically to this class, so manually recalculate bounds. | 1369 // propagate automatically to this class, so manually recalculate bounds. |
| 1369 Relayout(); | 1370 Relayout(); |
| 1370 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); | 1371 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); |
| 1371 } | 1372 } |
| 1372 | 1373 |
| 1373 } // namespace ash | 1374 } // namespace ash |
| OLD | NEW |