| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "ash/wm/property_util.h" | |
| 6 | |
| 7 #include "ash/screen_ash.h" | |
| 8 #include "ash/wm/window_properties.h" | |
| 9 #include "ui/aura/client/aura_constants.h" | |
| 10 #include "ui/aura/window.h" | |
| 11 #include "ui/base/ui_base_types.h" | |
| 12 #include "ui/gfx/rect.h" | |
| 13 | |
| 14 namespace ash { | |
| 15 | |
| 16 void SetRestoreBoundsInScreen(aura::Window* window, const gfx::Rect& bounds) { | |
| 17 window->SetProperty(aura::client::kRestoreBoundsKey, new gfx::Rect(bounds)); | |
| 18 } | |
| 19 | |
| 20 void SetRestoreBoundsInParent(aura::Window* window, const gfx::Rect& bounds) { | |
| 21 SetRestoreBoundsInScreen(window, | |
| 22 ScreenAsh::ConvertRectToScreen(window->parent(), bounds)); | |
| 23 } | |
| 24 | |
| 25 const gfx::Rect* GetRestoreBoundsInScreen(aura::Window* window) { | |
| 26 return window->GetProperty(aura::client::kRestoreBoundsKey); | |
| 27 } | |
| 28 | |
| 29 gfx::Rect GetRestoreBoundsInParent(aura::Window* window) { | |
| 30 const gfx::Rect* rect = GetRestoreBoundsInScreen(window); | |
| 31 if (!rect) | |
| 32 return gfx::Rect(); | |
| 33 return ScreenAsh::ConvertRectFromScreen(window->parent(), *rect); | |
| 34 } | |
| 35 | |
| 36 void ClearRestoreBounds(aura::Window* window) { | |
| 37 window->ClearProperty(aura::client::kRestoreBoundsKey); | |
| 38 } | |
| 39 | |
| 40 void SetWindowAlwaysRestoresToRestoreBounds(aura::Window* window, bool value) { | |
| 41 window->SetProperty(internal::kWindowRestoresToRestoreBounds, value); | |
| 42 } | |
| 43 | |
| 44 bool GetWindowAlwaysRestoresToRestoreBounds(const aura::Window* window) { | |
| 45 return window->GetProperty(internal::kWindowRestoresToRestoreBounds); | |
| 46 } | |
| 47 | |
| 48 } // namespace ash | |
| OLD | NEW |