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> | 7 #include <utility> |
8 | 8 |
9 #include "ash/screen_util.h" | 9 #include "ash/screen_util.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 window_state->SetBoundsDirect(bounds_in_parent); | 91 window_state->SetBoundsDirect(bounds_in_parent); |
92 } | 92 } |
93 | 93 |
94 MaximizeModeWindowState::MaximizeModeWindowState( | 94 MaximizeModeWindowState::MaximizeModeWindowState( |
95 aura::Window* window, MaximizeModeWindowManager* creator) | 95 aura::Window* window, MaximizeModeWindowManager* creator) |
96 : window_(window), | 96 : window_(window), |
97 creator_(creator), | 97 creator_(creator), |
98 current_state_type_(wm::GetWindowState(window)->GetStateType()), | 98 current_state_type_(wm::GetWindowState(window)->GetStateType()), |
99 defer_bounds_updates_(false) { | 99 defer_bounds_updates_(false) { |
100 old_state_.reset(wm::GetWindowState(window) | 100 old_state_.reset(wm::GetWindowState(window) |
101 ->SetStateObject(scoped_ptr<State>(this)) | 101 ->SetStateObject(std::unique_ptr<State>(this)) |
102 .release()); | 102 .release()); |
103 } | 103 } |
104 | 104 |
105 MaximizeModeWindowState::~MaximizeModeWindowState() { | 105 MaximizeModeWindowState::~MaximizeModeWindowState() { |
106 creator_->WindowStateDestroyed(window_); | 106 creator_->WindowStateDestroyed(window_); |
107 } | 107 } |
108 | 108 |
109 void MaximizeModeWindowState::LeaveMaximizeMode(wm::WindowState* window_state) { | 109 void MaximizeModeWindowState::LeaveMaximizeMode(wm::WindowState* window_state) { |
110 // 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|. |
111 scoped_ptr<wm::WindowState::State> our_reference = | 111 std::unique_ptr<wm::WindowState::State> our_reference = |
112 window_state->SetStateObject(std::move(old_state_)); | 112 window_state->SetStateObject(std::move(old_state_)); |
113 } | 113 } |
114 | 114 |
115 void MaximizeModeWindowState::SetDeferBoundsUpdates(bool defer_bounds_updates) { | 115 void MaximizeModeWindowState::SetDeferBoundsUpdates(bool defer_bounds_updates) { |
116 if (defer_bounds_updates_ == defer_bounds_updates) | 116 if (defer_bounds_updates_ == defer_bounds_updates) |
117 return; | 117 return; |
118 | 118 |
119 defer_bounds_updates_ = defer_bounds_updates; | 119 defer_bounds_updates_ = defer_bounds_updates; |
120 if (!defer_bounds_updates_) | 120 if (!defer_bounds_updates_) |
121 UpdateBounds(wm::GetWindowState(window_), true); | 121 UpdateBounds(wm::GetWindowState(window_), true); |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 // avoid flashing. | 306 // avoid flashing. |
307 if (window_state->IsMaximized()) | 307 if (window_state->IsMaximized()) |
308 window_state->SetBoundsDirectCrossFade(bounds_in_parent); | 308 window_state->SetBoundsDirectCrossFade(bounds_in_parent); |
309 else | 309 else |
310 window_state->SetBoundsDirectAnimated(bounds_in_parent); | 310 window_state->SetBoundsDirectAnimated(bounds_in_parent); |
311 } | 311 } |
312 } | 312 } |
313 } | 313 } |
314 | 314 |
315 } // namespace ash | 315 } // namespace ash |
OLD | NEW |