| 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/panels/panel_layout_manager.h" | 5 #include "ash/wm/panels/panel_layout_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "ash/screen_util.h" | 11 #include "ash/screen_util.h" |
| 12 #include "ash/shelf/shelf.h" | 12 #include "ash/shelf/shelf.h" |
| 13 #include "ash/shelf/shelf_layout_manager.h" | 13 #include "ash/shelf/shelf_layout_manager.h" |
| 14 #include "ash/shelf/shelf_types.h" | 14 #include "ash/shelf/shelf_types.h" |
| 15 #include "ash/shelf/shelf_util.h" | 15 #include "ash/shelf/shelf_util.h" |
| 16 #include "ash/shelf/shelf_widget.h" | 16 #include "ash/shelf/shelf_widget.h" |
| 17 #include "ash/shell.h" | 17 #include "ash/shell.h" |
| 18 #include "ash/shell_window_ids.h" | 18 #include "ash/shell_window_ids.h" |
| 19 #include "ash/wm/aura/wm_window_aura.h" |
| 20 #include "ash/wm/common/window_animation_types.h" |
| 21 #include "ash/wm/common/window_parenting_utils.h" |
| 19 #include "ash/wm/overview/window_selector_controller.h" | 22 #include "ash/wm/overview/window_selector_controller.h" |
| 20 #include "ash/wm/window_animations.h" | 23 #include "ash/wm/window_animations.h" |
| 21 #include "ash/wm/window_state.h" | 24 #include "ash/wm/window_state.h" |
| 22 #include "ash/wm/window_state_aura.h" | 25 #include "ash/wm/window_state_aura.h" |
| 23 #include "ash/wm/window_util.h" | 26 #include "ash/wm/window_util.h" |
| 24 #include "base/auto_reset.h" | 27 #include "base/auto_reset.h" |
| 25 #include "base/bind.h" | 28 #include "base/bind.h" |
| 26 #include "base/bind_helpers.h" | 29 #include "base/bind_helpers.h" |
| 27 #include "third_party/skia/include/core/SkColor.h" | 30 #include "third_party/skia/include/core/SkColor.h" |
| 28 #include "third_party/skia/include/core/SkPaint.h" | 31 #include "third_party/skia/include/core/SkPaint.h" |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 if (!wm::GetWindowState(child)->panel_attached()) { | 353 if (!wm::GetWindowState(child)->panel_attached()) { |
| 351 // This should only happen when a window is added to panel container as a | 354 // This should only happen when a window is added to panel container as a |
| 352 // result of bounds change from within the application during a drag. | 355 // result of bounds change from within the application during a drag. |
| 353 // If so we have already stopped the drag and should reparent the panel | 356 // If so we have already stopped the drag and should reparent the panel |
| 354 // back to appropriate container and ignore it. | 357 // back to appropriate container and ignore it. |
| 355 // TODO(varkha): Updating bounds during a drag can cause problems and a more | 358 // TODO(varkha): Updating bounds during a drag can cause problems and a more |
| 356 // general solution is needed. See http://crbug.com/251813 . | 359 // general solution is needed. See http://crbug.com/251813 . |
| 357 aura::Window* old_parent = child->parent(); | 360 aura::Window* old_parent = child->parent(); |
| 358 aura::client::ParentWindowWithContext( | 361 aura::client::ParentWindowWithContext( |
| 359 child, child, child->GetRootWindow()->GetBoundsInScreen()); | 362 child, child, child->GetRootWindow()->GetBoundsInScreen()); |
| 360 wm::ReparentTransientChildrenOfChild(child, old_parent, child->parent()); | 363 wm::ReparentTransientChildrenOfChild( |
| 364 wm::WmWindowAura::Get(child), wm::WmWindowAura::Get(old_parent), |
| 365 wm::WmWindowAura::Get(child->parent())); |
| 361 DCHECK(child->parent()->id() != kShellWindowId_PanelContainer); | 366 DCHECK(child->parent()->id() != kShellWindowId_PanelContainer); |
| 362 return; | 367 return; |
| 363 } | 368 } |
| 364 PanelInfo panel_info; | 369 PanelInfo panel_info; |
| 365 panel_info.window = child; | 370 panel_info.window = child; |
| 366 panel_info.callout_widget = new PanelCalloutWidget(panel_container_); | 371 panel_info.callout_widget = new PanelCalloutWidget(panel_container_); |
| 367 panel_info.slide_in = child != dragged_panel_; | 372 panel_info.slide_in = child != dragged_panel_; |
| 368 panel_windows_.push_back(panel_info); | 373 panel_windows_.push_back(panel_info); |
| 369 child->AddObserver(this); | 374 child->AddObserver(this); |
| 370 wm::GetWindowState(child)->AddObserver(this); | 375 wm::GetWindowState(child)->AddObserver(this); |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 } | 567 } |
| 563 } | 568 } |
| 564 restore_windows_on_shelf_visible_ = std::move(minimized_windows); | 569 restore_windows_on_shelf_visible_ = std::move(minimized_windows); |
| 565 } | 570 } |
| 566 | 571 |
| 567 //////////////////////////////////////////////////////////////////////////////// | 572 //////////////////////////////////////////////////////////////////////////////// |
| 568 // PanelLayoutManager private implementation: | 573 // PanelLayoutManager private implementation: |
| 569 | 574 |
| 570 void PanelLayoutManager::MinimizePanel(aura::Window* panel) { | 575 void PanelLayoutManager::MinimizePanel(aura::Window* panel) { |
| 571 ::wm::SetWindowVisibilityAnimationType( | 576 ::wm::SetWindowVisibilityAnimationType( |
| 572 panel, WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE); | 577 panel, wm::WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE); |
| 573 ui::Layer* layer = panel->layer(); | 578 ui::Layer* layer = panel->layer(); |
| 574 ui::ScopedLayerAnimationSettings panel_slide_settings(layer->GetAnimator()); | 579 ui::ScopedLayerAnimationSettings panel_slide_settings(layer->GetAnimator()); |
| 575 panel_slide_settings.SetPreemptionStrategy( | 580 panel_slide_settings.SetPreemptionStrategy( |
| 576 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | 581 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); |
| 577 panel_slide_settings.SetTransitionDuration( | 582 panel_slide_settings.SetTransitionDuration( |
| 578 base::TimeDelta::FromMilliseconds(kPanelSlideDurationMilliseconds)); | 583 base::TimeDelta::FromMilliseconds(kPanelSlideDurationMilliseconds)); |
| 579 gfx::Rect bounds(panel->bounds()); | 584 gfx::Rect bounds(panel->bounds()); |
| 580 bounds.Offset(GetSlideInAnimationOffset(shelf_->alignment())); | 585 bounds.Offset(GetSlideInAnimationOffset(shelf_->alignment())); |
| 581 SetChildBoundsDirect(panel, bounds); | 586 SetChildBoundsDirect(panel, bounds); |
| 582 panel->Hide(); | 587 panel->Hide(); |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 930 // Keyboard hidden, restore original bounds if they exist. | 935 // Keyboard hidden, restore original bounds if they exist. |
| 931 SetChildBounds(panel, panel_state->GetRestoreBoundsInScreen()); | 936 SetChildBounds(panel, panel_state->GetRestoreBoundsInScreen()); |
| 932 } | 937 } |
| 933 } | 938 } |
| 934 // This bounds change will have caused a change to the Shelf which does not | 939 // This bounds change will have caused a change to the Shelf which does not |
| 935 // propogate automatically to this class, so manually recalculate bounds. | 940 // propogate automatically to this class, so manually recalculate bounds. |
| 936 OnWindowResized(); | 941 OnWindowResized(); |
| 937 } | 942 } |
| 938 | 943 |
| 939 } // namespace ash | 944 } // namespace ash |
| OLD | NEW |