Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "athena/wm/window_manager_impl.h" | 5 #include "athena/wm/window_manager_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "athena/screen/public/screen_manager.h" | 9 #include "athena/screen/public/screen_manager.h" |
| 10 #include "athena/util/container_priorities.h" | 10 #include "athena/util/container_priorities.h" |
| 11 #include "athena/wm/bezel_controller.h" | 11 #include "athena/wm/bezel_controller.h" |
| 12 #include "athena/wm/public/window_manager_observer.h" | 12 #include "athena/wm/public/window_manager_observer.h" |
| 13 #include "athena/wm/split_view_controller.h" | 13 #include "athena/wm/split_view_controller.h" |
| 14 #include "athena/wm/title_drag_controller.h" | 14 #include "athena/wm/title_drag_controller.h" |
| 15 #include "athena/wm/window_list_provider_impl.h" | 15 #include "athena/wm/window_list_provider_impl.h" |
| 16 #include "athena/wm/window_overview_mode.h" | 16 #include "athena/wm/window_overview_mode.h" |
| 17 #include "base/bind.h" | 17 #include "base/bind.h" |
| 18 #include "base/logging.h" | 18 #include "base/logging.h" |
| 19 #include "ui/aura/client/aura_constants.h" | |
| 19 #include "ui/aura/layout_manager.h" | 20 #include "ui/aura/layout_manager.h" |
| 20 #include "ui/aura/window.h" | 21 #include "ui/aura/window.h" |
| 21 #include "ui/compositor/closure_animation_observer.h" | 22 #include "ui/compositor/closure_animation_observer.h" |
| 22 #include "ui/compositor/scoped_layer_animation_settings.h" | 23 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 23 #include "ui/gfx/display.h" | 24 #include "ui/gfx/display.h" |
| 24 #include "ui/gfx/screen.h" | 25 #include "ui/gfx/screen.h" |
| 25 #include "ui/wm/core/shadow_controller.h" | 26 #include "ui/wm/core/shadow_controller.h" |
| 26 #include "ui/wm/core/transient_window_manager.h" | 27 #include "ui/wm/core/transient_window_manager.h" |
| 27 #include "ui/wm/core/window_util.h" | 28 #include "ui/wm/core/window_util.h" |
| 28 #include "ui/wm/core/wm_state.h" | 29 #include "ui/wm/core/wm_state.h" |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 297 wm::ActivateWindow(window); | 298 wm::ActivateWindow(window); |
| 298 | 299 |
| 299 if (split_view_controller_->IsSplitViewModeActive()) { | 300 if (split_view_controller_->IsSplitViewModeActive()) { |
| 300 split_view_controller_->DeactivateSplitMode(); | 301 split_view_controller_->DeactivateSplitMode(); |
| 301 FOR_EACH_OBSERVER(WindowManagerObserver, observers_, OnSplitViewModeExit()); | 302 FOR_EACH_OBSERVER(WindowManagerObserver, observers_, OnSplitViewModeExit()); |
| 302 } | 303 } |
| 303 // If |window| does not have the size of the work-area, then make sure it is | 304 // If |window| does not have the size of the work-area, then make sure it is |
| 304 // resized. | 305 // resized. |
| 305 const gfx::Size work_area = | 306 const gfx::Size work_area = |
| 306 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().work_area().size(); | 307 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().work_area().size(); |
| 307 if (window->GetTargetBounds().size() != work_area) { | 308 |
| 309 // Make sure that the window can be maximized before resizing. | |
| 310 bool can_maximize = window->GetProperty(aura::client::kCanMaximizeKey); | |
|
oshima
2014/10/22 20:03:21
it should check both
can maximize and if it has ma
| |
| 311 | |
| 312 if (window->GetTargetBounds().size() != work_area && can_maximize) { | |
| 308 const gfx::Rect& window_bounds = window->bounds(); | 313 const gfx::Rect& window_bounds = window->bounds(); |
| 309 const gfx::Rect desired_bounds(work_area); | 314 const gfx::Rect desired_bounds(work_area); |
| 310 gfx::Transform transform; | 315 gfx::Transform transform; |
| 311 transform.Translate(desired_bounds.x() - window_bounds.x(), | 316 transform.Translate(desired_bounds.x() - window_bounds.x(), |
| 312 desired_bounds.y() - window_bounds.y()); | 317 desired_bounds.y() - window_bounds.y()); |
| 313 transform.Scale(desired_bounds.width() / window_bounds.width(), | 318 transform.Scale(desired_bounds.width() / window_bounds.width(), |
| 314 desired_bounds.height() / window_bounds.height()); | 319 desired_bounds.height() / window_bounds.height()); |
| 315 ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator()); | 320 ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator()); |
| 316 settings.SetPreemptionStrategy( | 321 settings.SetPreemptionStrategy( |
| 317 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | 322 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 453 DCHECK(!instance); | 458 DCHECK(!instance); |
| 454 } | 459 } |
| 455 | 460 |
| 456 // static | 461 // static |
| 457 WindowManager* WindowManager::Get() { | 462 WindowManager* WindowManager::Get() { |
| 458 DCHECK(instance); | 463 DCHECK(instance); |
| 459 return instance; | 464 return instance; |
| 460 } | 465 } |
| 461 | 466 |
| 462 } // namespace athena | 467 } // namespace athena |
| OLD | NEW |