| 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/shelf/shelf.h" | 7 #include "ash/shelf/shelf.h" |
| 8 #include "ash/shelf/shelf_constants.h" | 8 #include "ash/shelf/shelf_constants.h" |
| 9 #include "ash/shelf/shelf_layout_manager.h" | 9 #include "ash/shelf/shelf_layout_manager.h" |
| 10 #include "ash/shelf/shelf_layout_manager_observer.h" | 10 #include "ash/shelf/shelf_layout_manager_observer.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_window_ids.h" | 13 #include "ash/shell_window_ids.h" |
| 14 #include "ash/wm/common/window_animation_types.h" | 14 #include "ash/wm/common/window_animation_types.h" |
| 15 #include "ash/wm/common/window_parenting_utils.h" | 15 #include "ash/wm/common/window_parenting_utils.h" |
| 16 #include "ash/wm/common/wm_globals.h" | 16 #include "ash/wm/common/wm_globals.h" |
| 17 #include "ash/wm/common/wm_root_window_controller.h" | 17 #include "ash/wm/common/wm_root_window_controller.h" |
| 18 #include "ash/wm/common/wm_window.h" |
| 18 #include "ash/wm/window_animations.h" | 19 #include "ash/wm/window_animations.h" |
| 19 #include "ash/wm/window_resizer.h" | 20 #include "ash/wm/window_resizer.h" |
| 20 #include "ash/wm/window_state.h" | 21 #include "ash/wm/window_state.h" |
| 21 #include "ash/wm/workspace_controller.h" | |
| 22 #include "base/auto_reset.h" | 22 #include "base/auto_reset.h" |
| 23 #include "base/metrics/histogram.h" | 23 #include "base/metrics/histogram.h" |
| 24 #include "grit/ash_resources.h" | 24 #include "grit/ash_resources.h" |
| 25 #include "third_party/skia/include/core/SkColor.h" | 25 #include "third_party/skia/include/core/SkColor.h" |
| 26 #include "third_party/skia/include/core/SkPaint.h" | 26 #include "third_party/skia/include/core/SkPaint.h" |
| 27 #include "ui/base/resource/resource_bundle.h" | 27 #include "ui/base/resource/resource_bundle.h" |
| 28 #include "ui/compositor/paint_recorder.h" | 28 #include "ui/compositor/paint_recorder.h" |
| 29 #include "ui/compositor/scoped_layer_animation_settings.h" | 29 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 30 #include "ui/gfx/canvas.h" | 30 #include "ui/gfx/canvas.h" |
| 31 #include "ui/gfx/display.h" | 31 #include "ui/gfx/display.h" |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 private: | 398 private: |
| 399 DockedWindowLayoutManager* docked_layout_manager_; | 399 DockedWindowLayoutManager* docked_layout_manager_; |
| 400 gfx::Rect shelf_bounds_in_screen_; | 400 gfx::Rect shelf_bounds_in_screen_; |
| 401 | 401 |
| 402 DISALLOW_COPY_AND_ASSIGN(ShelfWindowObserver); | 402 DISALLOW_COPY_AND_ASSIGN(ShelfWindowObserver); |
| 403 }; | 403 }; |
| 404 | 404 |
| 405 //////////////////////////////////////////////////////////////////////////////// | 405 //////////////////////////////////////////////////////////////////////////////// |
| 406 // DockedWindowLayoutManager public implementation: | 406 // DockedWindowLayoutManager public implementation: |
| 407 DockedWindowLayoutManager::DockedWindowLayoutManager( | 407 DockedWindowLayoutManager::DockedWindowLayoutManager( |
| 408 wm::WmWindow* dock_container, | 408 wm::WmWindow* dock_container) |
| 409 WorkspaceController* workspace_controller) | |
| 410 : dock_container_(dock_container), | 409 : dock_container_(dock_container), |
| 411 root_window_controller_(dock_container->GetRootWindowController()), | 410 root_window_controller_(dock_container->GetRootWindowController()), |
| 412 in_layout_(false), | 411 in_layout_(false), |
| 413 dragged_window_(nullptr), | 412 dragged_window_(nullptr), |
| 414 is_dragged_window_docked_(false), | 413 is_dragged_window_docked_(false), |
| 415 is_dragged_from_dock_(false), | 414 is_dragged_from_dock_(false), |
| 416 shelf_(nullptr), | 415 shelf_(nullptr), |
| 417 workspace_controller_(workspace_controller), | 416 in_fullscreen_(root_window_controller_->GetWorkspaceWindowState() == |
| 418 in_fullscreen_(workspace_controller_->GetWindowState() == | |
| 419 wm::WORKSPACE_WINDOW_STATE_FULL_SCREEN), | 417 wm::WORKSPACE_WINDOW_STATE_FULL_SCREEN), |
| 420 docked_width_(0), | 418 docked_width_(0), |
| 421 alignment_(DOCKED_ALIGNMENT_NONE), | 419 alignment_(DOCKED_ALIGNMENT_NONE), |
| 422 preferred_alignment_(DOCKED_ALIGNMENT_NONE), | 420 preferred_alignment_(DOCKED_ALIGNMENT_NONE), |
| 423 event_source_(DOCKED_ACTION_SOURCE_UNKNOWN), | 421 event_source_(DOCKED_ACTION_SOURCE_UNKNOWN), |
| 424 last_active_window_(nullptr), | 422 last_active_window_(nullptr), |
| 425 last_action_time_(base::Time::Now()), | 423 last_action_time_(base::Time::Now()), |
| 426 background_widget_(nullptr) { | 424 background_widget_(nullptr) { |
| 427 DCHECK(dock_container); | 425 DCHECK(dock_container); |
| 428 dock_container->GetGlobals()->AddActivationObserver(this); | 426 dock_container->GetGlobals()->AddActivationObserver(this); |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 770 // DockedWindowLayoutManager, ash::ShellObserver implementation: | 768 // DockedWindowLayoutManager, ash::ShellObserver implementation: |
| 771 | 769 |
| 772 void DockedWindowLayoutManager::OnWorkAreaChanged() { | 770 void DockedWindowLayoutManager::OnWorkAreaChanged() { |
| 773 Relayout(); | 771 Relayout(); |
| 774 UpdateDockBounds(DockedWindowLayoutManagerObserver::DISPLAY_INSETS_CHANGED); | 772 UpdateDockBounds(DockedWindowLayoutManagerObserver::DISPLAY_INSETS_CHANGED); |
| 775 MaybeMinimizeChildrenExcept(dragged_window_); | 773 MaybeMinimizeChildrenExcept(dragged_window_); |
| 776 } | 774 } |
| 777 | 775 |
| 778 void DockedWindowLayoutManager::OnFullscreenStateChanged(bool is_fullscreen) { | 776 void DockedWindowLayoutManager::OnFullscreenStateChanged(bool is_fullscreen) { |
| 779 // Entering fullscreen mode (including immersive) hides docked windows. | 777 // Entering fullscreen mode (including immersive) hides docked windows. |
| 780 in_fullscreen_ = workspace_controller_->GetWindowState() == | 778 in_fullscreen_ = root_window_controller_->GetWorkspaceWindowState() == |
| 781 wm::WORKSPACE_WINDOW_STATE_FULL_SCREEN; | 779 wm::WORKSPACE_WINDOW_STATE_FULL_SCREEN; |
| 782 { | 780 { |
| 783 // prevent Relayout from getting called multiple times during this | 781 // prevent Relayout from getting called multiple times during this |
| 784 base::AutoReset<bool> auto_reset_in_layout(&in_layout_, true); | 782 base::AutoReset<bool> auto_reset_in_layout(&in_layout_, true); |
| 785 // Use a copy of children array because a call to MinimizeDockedWindow or | 783 // Use a copy of children array because a call to MinimizeDockedWindow or |
| 786 // RestoreDockedWindow can change order. | 784 // RestoreDockedWindow can change order. |
| 787 for (wm::WmWindow* window : dock_container_->GetChildren()) { | 785 for (wm::WmWindow* window : dock_container_->GetChildren()) { |
| 788 if (IsPopupOrTransient(window)) | 786 if (IsPopupOrTransient(window)) |
| 789 continue; | 787 continue; |
| 790 wm::WindowState* window_state = window->GetWindowState(); | 788 wm::WindowState* window_state = window->GetWindowState(); |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1336 | 1334 |
| 1337 void DockedWindowLayoutManager::OnKeyboardBoundsChanging( | 1335 void DockedWindowLayoutManager::OnKeyboardBoundsChanging( |
| 1338 const gfx::Rect& keyboard_bounds) { | 1336 const gfx::Rect& keyboard_bounds) { |
| 1339 // This bounds change will have caused a change to the Shelf which does not | 1337 // This bounds change will have caused a change to the Shelf which does not |
| 1340 // propagate automatically to this class, so manually recalculate bounds. | 1338 // propagate automatically to this class, so manually recalculate bounds. |
| 1341 Relayout(); | 1339 Relayout(); |
| 1342 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); | 1340 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); |
| 1343 } | 1341 } |
| 1344 | 1342 |
| 1345 } // namespace ash | 1343 } // namespace ash |
| OLD | NEW |