| 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 "ash/wm/maximize_mode/maximize_mode_window_state.h" | 5 #include "ash/wm/maximize_mode/maximize_mode_window_state.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "ash/screen_util.h" | 9 #include "ash/screen_util.h" |
| 8 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 9 #include "ash/shell_window_ids.h" | 11 #include "ash/shell_window_ids.h" |
| 10 #include "ash/wm/coordinate_conversion.h" | 12 #include "ash/wm/coordinate_conversion.h" |
| 11 #include "ash/wm/maximize_mode/maximize_mode_window_manager.h" | 13 #include "ash/wm/maximize_mode/maximize_mode_window_manager.h" |
| 12 #include "ash/wm/window_animations.h" | 14 #include "ash/wm/window_animations.h" |
| 13 #include "ash/wm/window_properties.h" | 15 #include "ash/wm/window_properties.h" |
| 14 #include "ash/wm/window_state_delegate.h" | 16 #include "ash/wm/window_state_delegate.h" |
| 15 #include "ash/wm/window_state_util.h" | 17 #include "ash/wm/window_state_util.h" |
| 16 #include "ash/wm/window_util.h" | 18 #include "ash/wm/window_util.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 return; | 90 return; |
| 89 window_state->SetBoundsDirect(bounds_in_parent); | 91 window_state->SetBoundsDirect(bounds_in_parent); |
| 90 } | 92 } |
| 91 | 93 |
| 92 MaximizeModeWindowState::MaximizeModeWindowState( | 94 MaximizeModeWindowState::MaximizeModeWindowState( |
| 93 aura::Window* window, MaximizeModeWindowManager* creator) | 95 aura::Window* window, MaximizeModeWindowManager* creator) |
| 94 : window_(window), | 96 : window_(window), |
| 95 creator_(creator), | 97 creator_(creator), |
| 96 current_state_type_(wm::GetWindowState(window)->GetStateType()), | 98 current_state_type_(wm::GetWindowState(window)->GetStateType()), |
| 97 defer_bounds_updates_(false) { | 99 defer_bounds_updates_(false) { |
| 98 old_state_.reset( | 100 old_state_.reset(wm::GetWindowState(window) |
| 99 wm::GetWindowState(window)->SetStateObject( | 101 ->SetStateObject(scoped_ptr<State>(this)) |
| 100 scoped_ptr<State>(this).Pass()).release()); | 102 .release()); |
| 101 } | 103 } |
| 102 | 104 |
| 103 MaximizeModeWindowState::~MaximizeModeWindowState() { | 105 MaximizeModeWindowState::~MaximizeModeWindowState() { |
| 104 creator_->WindowStateDestroyed(window_); | 106 creator_->WindowStateDestroyed(window_); |
| 105 } | 107 } |
| 106 | 108 |
| 107 void MaximizeModeWindowState::LeaveMaximizeMode(wm::WindowState* window_state) { | 109 void MaximizeModeWindowState::LeaveMaximizeMode(wm::WindowState* window_state) { |
| 108 // Note: When we return we will destroy ourselves with the |our_reference|. | 110 // Note: When we return we will destroy ourselves with the |our_reference|. |
| 109 scoped_ptr<wm::WindowState::State> our_reference = | 111 scoped_ptr<wm::WindowState::State> our_reference = |
| 110 window_state->SetStateObject(old_state_.Pass()); | 112 window_state->SetStateObject(std::move(old_state_)); |
| 111 } | 113 } |
| 112 | 114 |
| 113 void MaximizeModeWindowState::SetDeferBoundsUpdates(bool defer_bounds_updates) { | 115 void MaximizeModeWindowState::SetDeferBoundsUpdates(bool defer_bounds_updates) { |
| 114 if (defer_bounds_updates_ == defer_bounds_updates) | 116 if (defer_bounds_updates_ == defer_bounds_updates) |
| 115 return; | 117 return; |
| 116 | 118 |
| 117 defer_bounds_updates_ = defer_bounds_updates; | 119 defer_bounds_updates_ = defer_bounds_updates; |
| 118 if (!defer_bounds_updates_) | 120 if (!defer_bounds_updates_) |
| 119 UpdateBounds(wm::GetWindowState(window_), true); | 121 UpdateBounds(wm::GetWindowState(window_), true); |
| 120 } | 122 } |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 // avoid flashing. | 306 // avoid flashing. |
| 305 if (window_state->IsMaximized()) | 307 if (window_state->IsMaximized()) |
| 306 window_state->SetBoundsDirectCrossFade(bounds_in_parent); | 308 window_state->SetBoundsDirectCrossFade(bounds_in_parent); |
| 307 else | 309 else |
| 308 window_state->SetBoundsDirectAnimated(bounds_in_parent); | 310 window_state->SetBoundsDirectAnimated(bounds_in_parent); |
| 309 } | 311 } |
| 310 } | 312 } |
| 311 } | 313 } |
| 312 | 314 |
| 313 } // namespace ash | 315 } // namespace ash |
| OLD | NEW |