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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 // static | 84 // static |
85 void MaximizeModeWindowState::UpdateWindowPosition( | 85 void MaximizeModeWindowState::UpdateWindowPosition( |
86 wm::WindowState* window_state) { | 86 wm::WindowState* window_state) { |
87 gfx::Rect bounds_in_parent = GetBoundsInMaximizedMode(window_state); | 87 gfx::Rect bounds_in_parent = GetBoundsInMaximizedMode(window_state); |
88 if (bounds_in_parent == window_state->window()->GetBounds()) | 88 if (bounds_in_parent == window_state->window()->GetBounds()) |
89 return; | 89 return; |
90 window_state->SetBoundsDirect(bounds_in_parent); | 90 window_state->SetBoundsDirect(bounds_in_parent); |
91 } | 91 } |
92 | 92 |
93 MaximizeModeWindowState::MaximizeModeWindowState( | 93 MaximizeModeWindowState::MaximizeModeWindowState( |
94 WmWindow* window, | 94 aura::Window* window, |
95 MaximizeModeWindowManager* creator) | 95 MaximizeModeWindowManager* creator) |
96 : window_(window), | 96 : window_(window), |
97 creator_(creator), | 97 creator_(creator), |
98 current_state_type_(window->GetWindowState()->GetStateType()), | 98 current_state_type_(wm::GetWindowState(window)->GetStateType()), |
99 defer_bounds_updates_(false) { | 99 defer_bounds_updates_(false) { |
100 old_state_.reset(window_->GetWindowState() | 100 old_state_.reset(wm::GetWindowState(window) |
101 ->SetStateObject(std::unique_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 std::unique_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(window_->GetWindowState(), true); | 121 UpdateBounds(wm::GetWindowState(window_), true); |
122 } | 122 } |
123 | 123 |
124 void MaximizeModeWindowState::OnWMEvent(wm::WindowState* window_state, | 124 void MaximizeModeWindowState::OnWMEvent(wm::WindowState* window_state, |
125 const wm::WMEvent* event) { | 125 const wm::WMEvent* event) { |
126 // Ignore events that are sent during the exit transition. | 126 // Ignore events that are sent during the exit transition. |
127 if (ignore_wm_events_) { | 127 if (ignore_wm_events_) { |
128 return; | 128 return; |
129 } | 129 } |
130 | 130 |
131 switch (event->type()) { | 131 switch (event->type()) { |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 // avoid flashing. | 322 // avoid flashing. |
323 if (window_state->IsMaximized()) | 323 if (window_state->IsMaximized()) |
324 window_state->SetBoundsDirectCrossFade(bounds_in_parent); | 324 window_state->SetBoundsDirectCrossFade(bounds_in_parent); |
325 else | 325 else |
326 window_state->SetBoundsDirectAnimated(bounds_in_parent); | 326 window_state->SetBoundsDirectAnimated(bounds_in_parent); |
327 } | 327 } |
328 } | 328 } |
329 } | 329 } |
330 | 330 |
331 } // namespace ash | 331 } // namespace ash |
OLD | NEW |