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 10 matching lines...) Expand all Loading... | |
21 namespace wm { | 21 namespace wm { |
22 | 22 |
23 // static | 23 // static |
24 bool WindowState::IsMaximizedOrFullscreenState(ui::WindowShowState show_state) { | 24 bool WindowState::IsMaximizedOrFullscreenState(ui::WindowShowState show_state) { |
25 return show_state == ui::SHOW_STATE_FULLSCREEN || | 25 return show_state == ui::SHOW_STATE_FULLSCREEN || |
26 show_state == ui::SHOW_STATE_MAXIMIZED; | 26 show_state == ui::SHOW_STATE_MAXIMIZED; |
27 } | 27 } |
28 | 28 |
29 WindowState::WindowState(aura::Window* window) | 29 WindowState::WindowState(aura::Window* window) |
30 : window_(window), | 30 : window_(window), |
31 fullscreen_type_(FULLSCREEN_TYPE_OTHER), | |
31 tracked_by_workspace_(true), | 32 tracked_by_workspace_(true), |
32 window_position_managed_(false), | 33 window_position_managed_(false), |
33 bounds_changed_by_user_(false), | 34 bounds_changed_by_user_(false), |
34 panel_attached_(true), | 35 panel_attached_(true), |
35 continue_drag_after_reparent_(false), | 36 continue_drag_after_reparent_(false), |
36 ignored_by_shelf_(false), | 37 ignored_by_shelf_(false), |
37 can_consume_system_keys_(false), | 38 can_consume_system_keys_(false), |
38 top_row_keys_are_function_keys_(false), | 39 top_row_keys_are_function_keys_(false), |
39 always_restores_to_restore_bounds_(false), | 40 always_restores_to_restore_bounds_(false), |
40 window_show_type_(ToWindowShowType(GetShowState())) { | 41 window_show_type_(ToWindowShowType(GetShowState())) { |
(...skipping 12 matching lines...) Expand all Loading... | |
53 } | 54 } |
54 | 55 |
55 bool WindowState::IsMaximized() const { | 56 bool WindowState::IsMaximized() const { |
56 return GetShowState() == ui::SHOW_STATE_MAXIMIZED; | 57 return GetShowState() == ui::SHOW_STATE_MAXIMIZED; |
57 } | 58 } |
58 | 59 |
59 bool WindowState::IsFullscreen() const { | 60 bool WindowState::IsFullscreen() const { |
60 return GetShowState() == ui::SHOW_STATE_FULLSCREEN; | 61 return GetShowState() == ui::SHOW_STATE_FULLSCREEN; |
61 } | 62 } |
62 | 63 |
64 bool WindowState::IsImmersiveFullscreen() const { | |
65 if (!IsFullscreen()) | |
66 return false; | |
67 return fullscreen_type_ == FULLSCREEN_TYPE_IMMERSIVE_MINIMAL_CHROME || | |
68 fullscreen_type_ == FULLSCREEN_TYPE_IMMERSIVE_NO_CHROME; | |
69 } | |
70 | |
63 bool WindowState::IsMaximizedOrFullscreen() const { | 71 bool WindowState::IsMaximizedOrFullscreen() const { |
64 return IsMaximizedOrFullscreenState(GetShowState()); | 72 return IsMaximizedOrFullscreenState(GetShowState()); |
65 } | 73 } |
66 | 74 |
67 bool WindowState::IsNormalShowState() const { | 75 bool WindowState::IsNormalShowState() const { |
68 ui::WindowShowState state = window_->GetProperty(aura::client::kShowStateKey); | 76 ui::WindowShowState state = window_->GetProperty(aura::client::kShowStateKey); |
69 return state == ui::SHOW_STATE_NORMAL || state == ui::SHOW_STATE_DEFAULT; | 77 return state == ui::SHOW_STATE_NORMAL || state == ui::SHOW_STATE_DEFAULT; |
70 } | 78 } |
71 | 79 |
72 bool WindowState::IsActive() const { | 80 bool WindowState::IsActive() const { |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
184 | 192 |
185 void WindowState::SetRestoreBoundsInParent(const gfx::Rect& bounds) { | 193 void WindowState::SetRestoreBoundsInParent(const gfx::Rect& bounds) { |
186 SetRestoreBoundsInScreen( | 194 SetRestoreBoundsInScreen( |
187 ScreenAsh::ConvertRectToScreen(window_->parent(), bounds)); | 195 ScreenAsh::ConvertRectToScreen(window_->parent(), bounds)); |
188 } | 196 } |
189 | 197 |
190 void WindowState::ClearRestoreBounds() { | 198 void WindowState::ClearRestoreBounds() { |
191 window_->ClearProperty(aura::client::kRestoreBoundsKey); | 199 window_->ClearProperty(aura::client::kRestoreBoundsKey); |
192 } | 200 } |
193 | 201 |
202 void WindowState::SetFullscreenType(FullscreenType type) { | |
James Cook
2013/10/17 16:56:24
Do you need to be able to change the fullscreen ty
pkotwicz
2013/10/17 22:14:27
I now ignore calls to SetFullscreenType() when not
| |
203 if (fullscreen_type_ == type) | |
204 return; | |
205 FullscreenType old = fullscreen_type_; | |
206 fullscreen_type_ = type; | |
207 if (IsFullscreen()) { | |
208 FOR_EACH_OBSERVER(WindowStateObserver, observer_list_, | |
209 OnWindowFullscreenTypeChanged(this, old)); | |
210 } | |
211 } | |
212 | |
194 void WindowState::SetPreAutoManageWindowBounds( | 213 void WindowState::SetPreAutoManageWindowBounds( |
195 const gfx::Rect& bounds) { | 214 const gfx::Rect& bounds) { |
196 pre_auto_manage_window_bounds_.reset(new gfx::Rect(bounds)); | 215 pre_auto_manage_window_bounds_.reset(new gfx::Rect(bounds)); |
197 } | 216 } |
198 | 217 |
199 void WindowState::AddObserver(WindowStateObserver* observer) { | 218 void WindowState::AddObserver(WindowStateObserver* observer) { |
200 observer_list_.AddObserver(observer); | 219 observer_list_.AddObserver(observer); |
201 } | 220 } |
202 | 221 |
203 void WindowState::RemoveObserver(WindowStateObserver* observer) { | 222 void WindowState::RemoveObserver(WindowStateObserver* observer) { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
269 } | 288 } |
270 return settings; | 289 return settings; |
271 } | 290 } |
272 | 291 |
273 const WindowState* GetWindowState(const aura::Window* window) { | 292 const WindowState* GetWindowState(const aura::Window* window) { |
274 return GetWindowState(const_cast<aura::Window*>(window)); | 293 return GetWindowState(const_cast<aura::Window*>(window)); |
275 } | 294 } |
276 | 295 |
277 } // namespace wm | 296 } // namespace wm |
278 } // namespace ash | 297 } // namespace ash |
OLD | NEW |