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/public/cpp/shell_window_ids.h" | 9 #include "ash/public/cpp/shell_window_ids.h" |
10 #include "ash/screen_util.h" | 10 #include "ash/screen_util.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 // static | 104 // static |
105 void MaximizeModeWindowState::UpdateWindowPosition( | 105 void MaximizeModeWindowState::UpdateWindowPosition( |
106 wm::WindowState* window_state) { | 106 wm::WindowState* window_state) { |
107 gfx::Rect bounds_in_parent = GetBoundsInMaximizedMode(window_state); | 107 gfx::Rect bounds_in_parent = GetBoundsInMaximizedMode(window_state); |
108 if (bounds_in_parent == window_state->window()->bounds()) | 108 if (bounds_in_parent == window_state->window()->bounds()) |
109 return; | 109 return; |
110 window_state->SetBoundsDirect(bounds_in_parent); | 110 window_state->SetBoundsDirect(bounds_in_parent); |
111 } | 111 } |
112 | 112 |
113 MaximizeModeWindowState::MaximizeModeWindowState( | 113 MaximizeModeWindowState::MaximizeModeWindowState( |
114 WmWindow* window, | 114 aura::Window* window, |
115 MaximizeModeWindowManager* creator) | 115 MaximizeModeWindowManager* creator) |
116 : window_(window), | 116 : window_(window), |
117 creator_(creator), | 117 creator_(creator), |
118 current_state_type_(window->GetWindowState()->GetStateType()), | 118 current_state_type_(wm::GetWindowState(window)->GetStateType()), |
119 defer_bounds_updates_(false) { | 119 defer_bounds_updates_(false) { |
120 old_state_.reset(window_->GetWindowState() | 120 old_state_.reset(wm::GetWindowState(window) |
121 ->SetStateObject(std::unique_ptr<State>(this)) | 121 ->SetStateObject(std::unique_ptr<State>(this)) |
122 .release()); | 122 .release()); |
123 } | 123 } |
124 | 124 |
125 MaximizeModeWindowState::~MaximizeModeWindowState() { | 125 MaximizeModeWindowState::~MaximizeModeWindowState() { |
126 creator_->WindowStateDestroyed(window_); | 126 creator_->WindowStateDestroyed(window_); |
127 } | 127 } |
128 | 128 |
129 void MaximizeModeWindowState::LeaveMaximizeMode(wm::WindowState* window_state) { | 129 void MaximizeModeWindowState::LeaveMaximizeMode(wm::WindowState* window_state) { |
130 // Note: When we return we will destroy ourselves with the |our_reference|. | 130 // Note: When we return we will destroy ourselves with the |our_reference|. |
131 std::unique_ptr<wm::WindowState::State> our_reference = | 131 std::unique_ptr<wm::WindowState::State> our_reference = |
132 window_state->SetStateObject(std::move(old_state_)); | 132 window_state->SetStateObject(std::move(old_state_)); |
133 } | 133 } |
134 | 134 |
135 void MaximizeModeWindowState::SetDeferBoundsUpdates(bool defer_bounds_updates) { | 135 void MaximizeModeWindowState::SetDeferBoundsUpdates(bool defer_bounds_updates) { |
136 if (defer_bounds_updates_ == defer_bounds_updates) | 136 if (defer_bounds_updates_ == defer_bounds_updates) |
137 return; | 137 return; |
138 | 138 |
139 defer_bounds_updates_ = defer_bounds_updates; | 139 defer_bounds_updates_ = defer_bounds_updates; |
140 if (!defer_bounds_updates_) | 140 if (!defer_bounds_updates_) |
141 UpdateBounds(window_->GetWindowState(), true); | 141 UpdateBounds(wm::GetWindowState(window_), true); |
142 } | 142 } |
143 | 143 |
144 void MaximizeModeWindowState::OnWMEvent(wm::WindowState* window_state, | 144 void MaximizeModeWindowState::OnWMEvent(wm::WindowState* window_state, |
145 const wm::WMEvent* event) { | 145 const wm::WMEvent* event) { |
146 // Ignore events that are sent during the exit transition. | 146 // Ignore events that are sent during the exit transition. |
147 if (ignore_wm_events_) { | 147 if (ignore_wm_events_) { |
148 return; | 148 return; |
149 } | 149 } |
150 | 150 |
151 switch (event->type()) { | 151 switch (event->type()) { |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 // avoid flashing. | 342 // avoid flashing. |
343 if (window_state->IsMaximized()) | 343 if (window_state->IsMaximized()) |
344 window_state->SetBoundsDirectCrossFade(bounds_in_parent); | 344 window_state->SetBoundsDirectCrossFade(bounds_in_parent); |
345 else | 345 else |
346 window_state->SetBoundsDirectAnimated(bounds_in_parent); | 346 window_state->SetBoundsDirectAnimated(bounds_in_parent); |
347 } | 347 } |
348 } | 348 } |
349 } | 349 } |
350 | 350 |
351 } // namespace ash | 351 } // namespace ash |
OLD | NEW |