| 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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 if (!wm::GetWindowState(child)->panel_attached()) { | 345 if (!wm::GetWindowState(child)->panel_attached()) { |
| 343 // This should only happen when a window is added to panel container as a | 346 // This should only happen when a window is added to panel container as a |
| 344 // result of bounds change from within the application during a drag. | 347 // result of bounds change from within the application during a drag. |
| 345 // If so we have already stopped the drag and should reparent the panel | 348 // If so we have already stopped the drag and should reparent the panel |
| 346 // back to appropriate container and ignore it. | 349 // back to appropriate container and ignore it. |
| 347 // TODO(varkha): Updating bounds during a drag can cause problems and a more | 350 // TODO(varkha): Updating bounds during a drag can cause problems and a more |
| 348 // general solution is needed. See http://crbug.com/251813 . | 351 // general solution is needed. See http://crbug.com/251813 . |
| 349 aura::Window* old_parent = child->parent(); | 352 aura::Window* old_parent = child->parent(); |
| 350 aura::client::ParentWindowWithContext( | 353 aura::client::ParentWindowWithContext( |
| 351 child, child, child->GetRootWindow()->GetBoundsInScreen()); | 354 child, child, child->GetRootWindow()->GetBoundsInScreen()); |
| 352 wm::ReparentTransientChildrenOfChild(child, old_parent, child->parent()); | 355 wm::ReparentTransientChildrenOfChild( |
| 356 wm::WmWindowAura::Get(child), wm::WmWindowAura::Get(old_parent), |
| 357 wm::WmWindowAura::Get(child->parent())); |
| 353 DCHECK(child->parent()->id() != kShellWindowId_PanelContainer); | 358 DCHECK(child->parent()->id() != kShellWindowId_PanelContainer); |
| 354 return; | 359 return; |
| 355 } | 360 } |
| 356 PanelInfo panel_info; | 361 PanelInfo panel_info; |
| 357 panel_info.window = child; | 362 panel_info.window = child; |
| 358 panel_info.callout_widget = new PanelCalloutWidget(panel_container_); | 363 panel_info.callout_widget = new PanelCalloutWidget(panel_container_); |
| 359 panel_info.slide_in = child != dragged_panel_; | 364 panel_info.slide_in = child != dragged_panel_; |
| 360 panel_windows_.push_back(panel_info); | 365 panel_windows_.push_back(panel_info); |
| 361 child->AddObserver(this); | 366 child->AddObserver(this); |
| 362 wm::GetWindowState(child)->AddObserver(this); | 367 wm::GetWindowState(child)->AddObserver(this); |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 } | 559 } |
| 555 } | 560 } |
| 556 restore_windows_on_shelf_visible_ = std::move(minimized_windows); | 561 restore_windows_on_shelf_visible_ = std::move(minimized_windows); |
| 557 } | 562 } |
| 558 | 563 |
| 559 //////////////////////////////////////////////////////////////////////////////// | 564 //////////////////////////////////////////////////////////////////////////////// |
| 560 // PanelLayoutManager private implementation: | 565 // PanelLayoutManager private implementation: |
| 561 | 566 |
| 562 void PanelLayoutManager::MinimizePanel(aura::Window* panel) { | 567 void PanelLayoutManager::MinimizePanel(aura::Window* panel) { |
| 563 ::wm::SetWindowVisibilityAnimationType( | 568 ::wm::SetWindowVisibilityAnimationType( |
| 564 panel, WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE); | 569 panel, wm::WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE); |
| 565 ui::Layer* layer = panel->layer(); | 570 ui::Layer* layer = panel->layer(); |
| 566 ui::ScopedLayerAnimationSettings panel_slide_settings(layer->GetAnimator()); | 571 ui::ScopedLayerAnimationSettings panel_slide_settings(layer->GetAnimator()); |
| 567 panel_slide_settings.SetPreemptionStrategy( | 572 panel_slide_settings.SetPreemptionStrategy( |
| 568 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | 573 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); |
| 569 panel_slide_settings.SetTransitionDuration( | 574 panel_slide_settings.SetTransitionDuration( |
| 570 base::TimeDelta::FromMilliseconds(kPanelSlideDurationMilliseconds)); | 575 base::TimeDelta::FromMilliseconds(kPanelSlideDurationMilliseconds)); |
| 571 gfx::Rect bounds(panel->bounds()); | 576 gfx::Rect bounds(panel->bounds()); |
| 572 bounds.Offset(GetSlideInAnimationOffset(shelf_->alignment())); | 577 bounds.Offset(GetSlideInAnimationOffset(shelf_->alignment())); |
| 573 SetChildBoundsDirect(panel, bounds); | 578 SetChildBoundsDirect(panel, bounds); |
| 574 panel->Hide(); | 579 panel->Hide(); |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 // Keyboard hidden, restore original bounds if they exist. | 917 // Keyboard hidden, restore original bounds if they exist. |
| 913 SetChildBounds(panel, panel_state->GetRestoreBoundsInScreen()); | 918 SetChildBounds(panel, panel_state->GetRestoreBoundsInScreen()); |
| 914 } | 919 } |
| 915 } | 920 } |
| 916 // This bounds change will have caused a change to the Shelf which does not | 921 // This bounds change will have caused a change to the Shelf which does not |
| 917 // propogate automatically to this class, so manually recalculate bounds. | 922 // propogate automatically to this class, so manually recalculate bounds. |
| 918 OnWindowResized(); | 923 OnWindowResized(); |
| 919 } | 924 } |
| 920 | 925 |
| 921 } // namespace ash | 926 } // namespace ash |
| OLD | NEW |