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/wm/window_state.h" | 5 #include "ash/wm/window_state.h" |
6 | 6 |
7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
8 #include "ash/screen_ash.h" | 8 #include "ash/screen_ash.h" |
9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
10 #include "ash/wm/window_properties.h" | 10 #include "ash/wm/window_properties.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 } | 163 } |
164 | 164 |
165 void WindowState::ToggleMaximized() { | 165 void WindowState::ToggleMaximized() { |
166 if (IsMaximized()) | 166 if (IsMaximized()) |
167 Restore(); | 167 Restore(); |
168 else if (CanMaximize()) | 168 else if (CanMaximize()) |
169 Maximize(); | 169 Maximize(); |
170 } | 170 } |
171 | 171 |
172 void WindowState::ToggleFullscreen() { | 172 void WindowState::ToggleFullscreen() { |
173 // Window which cannot be maximized should not be fullscreened. | |
174 // It can, however, be restored if it was fullscreened. | |
175 bool is_fullscreen = IsFullscreen(); | 173 bool is_fullscreen = IsFullscreen(); |
176 if (!is_fullscreen && !CanMaximize()) | |
177 return; | |
178 if (delegate_ && delegate_->ToggleFullscreen(this)) | |
179 return; | |
180 if (is_fullscreen) { | 174 if (is_fullscreen) { |
181 Restore(); | 175 if (delegate_ && delegate_->ExitFullscreen(this)) |
| 176 return; |
| 177 Restore(); |
182 } else { | 178 } else { |
183 window_->SetProperty(aura::client::kShowStateKey, | 179 // Windows which cannot be maximized should not be fullscreened. |
184 ui::SHOW_STATE_FULLSCREEN); | 180 if (CanMaximize()) { |
| 181 if (delegate_ && delegate_->EnterImmersiveFullscreen(this)) |
| 182 return; |
| 183 |
| 184 window_->SetProperty(aura::client::kShowStateKey, |
| 185 ui::SHOW_STATE_FULLSCREEN); |
| 186 } |
185 } | 187 } |
186 } | 188 } |
187 | 189 |
188 void WindowState::SetBoundsInScreen( | 190 void WindowState::SetBoundsInScreen( |
189 const gfx::Rect& bounds_in_screen) { | 191 const gfx::Rect& bounds_in_screen) { |
190 gfx::Rect bounds_in_parent = | 192 gfx::Rect bounds_in_parent = |
191 ScreenAsh::ConvertRectFromScreen(window_->parent(), | 193 ScreenAsh::ConvertRectFromScreen(window_->parent(), |
192 bounds_in_screen); | 194 bounds_in_screen); |
193 window_->SetBounds(bounds_in_parent); | 195 window_->SetBounds(bounds_in_parent); |
194 } | 196 } |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 } | 302 } |
301 return settings; | 303 return settings; |
302 } | 304 } |
303 | 305 |
304 const WindowState* GetWindowState(const aura::Window* window) { | 306 const WindowState* GetWindowState(const aura::Window* window) { |
305 return GetWindowState(const_cast<aura::Window*>(window)); | 307 return GetWindowState(const_cast<aura::Window*>(window)); |
306 } | 308 } |
307 | 309 |
308 } // namespace wm | 310 } // namespace wm |
309 } // namespace ash | 311 } // namespace ash |
OLD | NEW |