| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/common/wm/overview/scoped_transform_overview_window.h" | 5 #include "ash/common/wm/overview/scoped_transform_overview_window.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/common/wm/overview/scoped_overview_animation_settings.h" | 10 #include "ash/common/wm/overview/scoped_overview_animation_settings.h" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 } | 166 } |
| 167 | 167 |
| 168 } // namespace | 168 } // namespace |
| 169 | 169 |
| 170 ScopedTransformOverviewWindow::ScopedTransformOverviewWindow(WmWindow* window) | 170 ScopedTransformOverviewWindow::ScopedTransformOverviewWindow(WmWindow* window) |
| 171 : window_(window), | 171 : window_(window), |
| 172 determined_original_window_shape_(false), | 172 determined_original_window_shape_(false), |
| 173 ignored_by_shelf_(window->GetWindowState()->ignored_by_shelf()), | 173 ignored_by_shelf_(window->GetWindowState()->ignored_by_shelf()), |
| 174 overview_started_(false), | 174 overview_started_(false), |
| 175 original_transform_(window->GetTargetTransform()), | 175 original_transform_(window->GetTargetTransform()), |
| 176 original_opacity_(window->GetTargetOpacity()), |
| 176 weak_ptr_factory_(this) {} | 177 weak_ptr_factory_(this) {} |
| 177 | 178 |
| 178 ScopedTransformOverviewWindow::~ScopedTransformOverviewWindow() {} | 179 ScopedTransformOverviewWindow::~ScopedTransformOverviewWindow() {} |
| 179 | 180 |
| 180 void ScopedTransformOverviewWindow::RestoreWindow() { | 181 void ScopedTransformOverviewWindow::RestoreWindow() { |
| 181 ShowHeader(); | 182 ShowHeader(); |
| 182 if (minimized_widget_) { | 183 if (minimized_widget_) { |
| 183 // TODO(oshima): Use unminimize animation instead of hiding animation. | 184 // TODO(oshima): Use unminimize animation instead of hiding animation. |
| 184 minimized_widget_->CloseNow(); | 185 minimized_widget_->CloseNow(); |
| 185 minimized_widget_.reset(); | 186 minimized_widget_.reset(); |
| 186 return; | 187 return; |
| 187 } | 188 } |
| 188 ScopedAnimationSettings animation_settings_list; | 189 ScopedAnimationSettings animation_settings_list; |
| 189 BeginScopedAnimation(OverviewAnimationType::OVERVIEW_ANIMATION_RESTORE_WINDOW, | 190 BeginScopedAnimation(OverviewAnimationType::OVERVIEW_ANIMATION_RESTORE_WINDOW, |
| 190 &animation_settings_list); | 191 &animation_settings_list); |
| 191 SetTransform(window()->GetRootWindow(), original_transform_); | 192 SetTransform(window()->GetRootWindow(), original_transform_); |
| 192 std::unique_ptr<ScopedOverviewAnimationSettings> animation_settings = | 193 std::unique_ptr<ScopedOverviewAnimationSettings> animation_settings = |
| 193 CreateScopedOverviewAnimationSettings( | 194 CreateScopedOverviewAnimationSettings( |
| 194 OverviewAnimationType::OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS, | 195 OverviewAnimationType::OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS, |
| 195 window_); | 196 window_); |
| 196 window_->GetWindowState()->set_ignored_by_shelf(ignored_by_shelf_); | 197 window_->GetWindowState()->set_ignored_by_shelf(ignored_by_shelf_); |
| 198 SetOpacity(original_opacity_); |
| 197 } | 199 } |
| 198 | 200 |
| 199 void ScopedTransformOverviewWindow::BeginScopedAnimation( | 201 void ScopedTransformOverviewWindow::BeginScopedAnimation( |
| 200 OverviewAnimationType animation_type, | 202 OverviewAnimationType animation_type, |
| 201 ScopedAnimationSettings* animation_settings) { | 203 ScopedAnimationSettings* animation_settings) { |
| 202 for (auto* window : GetTransientTreeIterator(GetOverviewWindow())) { | 204 for (auto* window : GetTransientTreeIterator(GetOverviewWindow())) { |
| 203 animation_settings->push_back( | 205 animation_settings->push_back( |
| 204 CreateScopedOverviewAnimationSettings(animation_type, window)); | 206 CreateScopedOverviewAnimationSettings(animation_type, window)); |
| 205 } | 207 } |
| 206 } | 208 } |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 // In unit tests, the content view can have empty size. | 493 // In unit tests, the content view can have empty size. |
| 492 if (!preferred.IsEmpty()) { | 494 if (!preferred.IsEmpty()) { |
| 493 int inset = bounds.height() - preferred.height(); | 495 int inset = bounds.height() - preferred.height(); |
| 494 bounds.Inset(0, 0, 0, inset); | 496 bounds.Inset(0, 0, 0, inset); |
| 495 } | 497 } |
| 496 minimized_widget_->SetBounds(bounds); | 498 minimized_widget_->SetBounds(bounds); |
| 497 minimized_widget_->Show(); | 499 minimized_widget_->Show(); |
| 498 } | 500 } |
| 499 | 501 |
| 500 } // namespace ash | 502 } // namespace ash |
| OLD | NEW |