| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/aura_shell/window_util.h" | 5 #include "ui/aura_shell/window_util.h" |
| 6 | 6 |
| 7 #include "ui/aura/window.h" | 7 #include "ui/aura/window.h" |
| 8 #include "ui/aura/client/aura_constants.h" | 8 #include "ui/aura/client/aura_constants.h" |
| 9 #include "ui/aura_shell/property_util.h" |
| 9 #include "ui/base/ui_base_types.h" | 10 #include "ui/base/ui_base_types.h" |
| 11 #include "ui/gfx/screen.h" |
| 10 | 12 |
| 11 namespace aura_shell { | 13 namespace aura_shell { |
| 14 namespace window_util { |
| 12 | 15 |
| 13 bool IsWindowMaximized(aura::Window* window) { | 16 bool IsWindowMaximized(aura::Window* window) { |
| 14 return window->GetIntProperty(aura::kShowStateKey) == | 17 return window->GetIntProperty(aura::kShowStateKey) == |
| 15 ui::SHOW_STATE_MAXIMIZED; | 18 ui::SHOW_STATE_MAXIMIZED; |
| 16 } | 19 } |
| 17 | 20 |
| 21 void UpdateBoundsFromShowState(aura::Window* window) { |
| 22 switch (window->GetIntProperty(aura::kShowStateKey)) { |
| 23 case ui::SHOW_STATE_NORMAL: { |
| 24 const gfx::Rect* restore = GetRestoreBounds(window); |
| 25 window->SetProperty(aura::kRestoreBoundsKey, NULL); |
| 26 if (restore) |
| 27 window->SetBounds(*restore); |
| 28 delete restore; |
| 29 break; |
| 30 } |
| 31 |
| 32 case ui::SHOW_STATE_MAXIMIZED: |
| 33 SetRestoreBoundsIfNotSet(window); |
| 34 window->SetBounds(gfx::Screen::GetMonitorWorkAreaNearestWindow(window)); |
| 35 break; |
| 36 |
| 37 case ui::SHOW_STATE_FULLSCREEN: |
| 38 SetRestoreBoundsIfNotSet(window); |
| 39 window->SetBounds(gfx::Screen::GetMonitorAreaNearestWindow(window)); |
| 40 break; |
| 41 |
| 42 default: |
| 43 break; |
| 44 } |
| 45 } |
| 46 |
| 47 } // namespace window_util |
| 18 } // namespace aura_shell | 48 } // namespace aura_shell |
| OLD | NEW |