Chromium Code Reviews| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 51 | 51 |
| 52 void WindowState::SetDelegate(scoped_ptr<WindowStateDelegate> delegate) { | 52 void WindowState::SetDelegate(scoped_ptr<WindowStateDelegate> delegate) { |
| 53 DCHECK(!delegate_.get()); | 53 DCHECK(!delegate_.get()); |
| 54 delegate_ = delegate.Pass(); | 54 delegate_ = delegate.Pass(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 ui::WindowShowState WindowState::GetShowState() const { | 57 ui::WindowShowState WindowState::GetShowState() const { |
| 58 return window_->GetProperty(aura::client::kShowStateKey); | 58 return window_->GetProperty(aura::client::kShowStateKey); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void WindowState::SetWindowShowType(WindowShowType window_show_type) { | |
| 62 window_show_type_ = window_show_type; | |
|
pkotwicz
2013/11/18 16:25:20
SnapSizer actually calls WindowState::SnapWindow()
varkha
2013/11/20 00:11:13
Done. Removed (in favor of sending notifications w
| |
| 63 // TODO(oshima): Notify only when the state has changed. | |
| 64 // Doing so break a few tests now. | |
| 65 FOR_EACH_OBSERVER( | |
| 66 WindowStateObserver, observer_list_, | |
| 67 OnWindowShowTypeChanged(this, ToWindowShowType(GetShowState()))); | |
| 68 } | |
| 69 | |
| 61 bool WindowState::IsMinimized() const { | 70 bool WindowState::IsMinimized() const { |
| 62 return GetShowState() == ui::SHOW_STATE_MINIMIZED; | 71 return GetShowState() == ui::SHOW_STATE_MINIMIZED; |
| 63 } | 72 } |
| 64 | 73 |
| 65 bool WindowState::IsMaximized() const { | 74 bool WindowState::IsMaximized() const { |
| 66 return GetShowState() == ui::SHOW_STATE_MAXIMIZED; | 75 return GetShowState() == ui::SHOW_STATE_MAXIMIZED; |
| 67 } | 76 } |
| 68 | 77 |
| 69 bool WindowState::IsFullscreen() const { | 78 bool WindowState::IsFullscreen() const { |
| 70 return GetShowState() == ui::SHOW_STATE_FULLSCREEN; | 79 return GetShowState() == ui::SHOW_STATE_FULLSCREEN; |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 274 // changes occurs and the original restore bounds is remembered. | 283 // changes occurs and the original restore bounds is remembered. |
| 275 gfx::Rect restore_bounds_in_screen = | 284 gfx::Rect restore_bounds_in_screen = |
| 276 GetRestoreBoundsInScreen(); | 285 GetRestoreBoundsInScreen(); |
| 277 SetRestoreBoundsInParent(bounds); | 286 SetRestoreBoundsInParent(bounds); |
| 278 Restore(); | 287 Restore(); |
| 279 SetRestoreBoundsInScreen(restore_bounds_in_screen); | 288 SetRestoreBoundsInScreen(restore_bounds_in_screen); |
| 280 } else { | 289 } else { |
| 281 window_->SetBounds(bounds); | 290 window_->SetBounds(bounds); |
| 282 } | 291 } |
| 283 DCHECK(left_or_right == SHOW_TYPE_LEFT_SNAPPED || | 292 DCHECK(left_or_right == SHOW_TYPE_LEFT_SNAPPED || |
| 284 left_or_right == SHOW_TYPE_RIGHT_SNAPPED); | 293 left_or_right == SHOW_TYPE_RIGHT_SNAPPED); |
|
pkotwicz
2013/11/18 16:25:20
Oshima-san, is there a reason why we do not notify
oshima
2013/11/18 18:44:44
No specific reason other than LEFT/RIGHT SNAPPED s
varkha
2013/11/20 00:11:13
Done. I am notifying first to allow observers to t
| |
| 285 window_show_type_ = left_or_right; | 294 window_show_type_ = left_or_right; |
| 286 } | 295 } |
| 287 | 296 |
| 288 WindowState* GetActiveWindowState() { | 297 WindowState* GetActiveWindowState() { |
| 289 aura::Window* active = GetActiveWindow(); | 298 aura::Window* active = GetActiveWindow(); |
| 290 return active ? GetWindowState(active) : NULL; | 299 return active ? GetWindowState(active) : NULL; |
| 291 } | 300 } |
| 292 | 301 |
| 293 WindowState* GetWindowState(aura::Window* window) { | 302 WindowState* GetWindowState(aura::Window* window) { |
| 294 if (!window) | 303 if (!window) |
| 295 return NULL; | 304 return NULL; |
| 296 WindowState* settings = window->GetProperty(internal::kWindowStateKey); | 305 WindowState* settings = window->GetProperty(internal::kWindowStateKey); |
| 297 if(!settings) { | 306 if(!settings) { |
| 298 settings = new WindowState(window); | 307 settings = new WindowState(window); |
| 299 window->SetProperty(internal::kWindowStateKey, settings); | 308 window->SetProperty(internal::kWindowStateKey, settings); |
| 300 } | 309 } |
| 301 return settings; | 310 return settings; |
| 302 } | 311 } |
| 303 | 312 |
| 304 const WindowState* GetWindowState(const aura::Window* window) { | 313 const WindowState* GetWindowState(const aura::Window* window) { |
| 305 return GetWindowState(const_cast<aura::Window*>(window)); | 314 return GetWindowState(const_cast<aura::Window*>(window)); |
| 306 } | 315 } |
| 307 | 316 |
| 308 } // namespace wm | 317 } // namespace wm |
| 309 } // namespace ash | 318 } // namespace ash |
| OLD | NEW |