OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/property_util.h" | 5 #include "ash/wm/property_util.h" |
6 | 6 |
7 #include "ash/wm/window_util.h" | 7 #include "ash/wm/window_util.h" |
8 #include "ui/aura/client/aura_constants.h" | 8 #include "ui/aura/client/aura_constants.h" |
9 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
| 10 #include "ui/aura/window_property.h" |
10 #include "ui/base/ui_base_types.h" | 11 #include "ui/base/ui_base_types.h" |
11 #include "ui/gfx/rect.h" | 12 #include "ui/gfx/rect.h" |
12 | 13 |
| 14 DECLARE_WINDOW_PROPERTY_TYPE(bool) |
| 15 |
13 namespace ash { | 16 namespace ash { |
14 | 17 |
| 18 namespace { |
| 19 |
| 20 const aura::WindowProperty<bool> kWindowTrackedByWorkspaceSplitProp = {true}; |
| 21 |
| 22 } // namespace |
| 23 |
15 void SetRestoreBounds(aura::Window* window, const gfx::Rect& bounds) { | 24 void SetRestoreBounds(aura::Window* window, const gfx::Rect& bounds) { |
16 scoped_ptr<const gfx::Rect> old_bounds(GetRestoreBounds(window)); | 25 scoped_ptr<const gfx::Rect> old_bounds(GetRestoreBounds(window)); |
17 window->SetProperty(aura::client::kRestoreBoundsKey, new gfx::Rect(bounds)); | 26 window->SetProperty(aura::client::kRestoreBoundsKey, new gfx::Rect(bounds)); |
18 } | 27 } |
19 | 28 |
20 void SetRestoreBoundsIfNotSet(aura::Window* window) { | 29 void SetRestoreBoundsIfNotSet(aura::Window* window) { |
21 if (!GetRestoreBounds(window)) | 30 if (!GetRestoreBounds(window)) |
22 SetRestoreBounds(window, window->bounds()); | 31 SetRestoreBounds(window, window->bounds()); |
23 } | 32 } |
24 | 33 |
25 const gfx::Rect* GetRestoreBounds(aura::Window* window) { | 34 const gfx::Rect* GetRestoreBounds(aura::Window* window) { |
26 return window->GetProperty(aura::client::kRestoreBoundsKey); | 35 return window->GetProperty(aura::client::kRestoreBoundsKey); |
27 } | 36 } |
28 | 37 |
29 void ClearRestoreBounds(aura::Window* window) { | 38 void ClearRestoreBounds(aura::Window* window) { |
30 scoped_ptr<const gfx::Rect> old_bounds(GetRestoreBounds(window)); | 39 scoped_ptr<const gfx::Rect> old_bounds(GetRestoreBounds(window)); |
31 window->ClearProperty(aura::client::kRestoreBoundsKey); | 40 window->ClearProperty(aura::client::kRestoreBoundsKey); |
32 } | 41 } |
33 | 42 |
34 void ToggleMaximizedState(aura::Window* window) { | 43 void ToggleMaximizedState(aura::Window* window) { |
35 window->SetProperty(aura::client::kShowStateKey, | 44 window->SetProperty(aura::client::kShowStateKey, |
36 wm::IsWindowMaximized(window) ? ui::SHOW_STATE_NORMAL | 45 wm::IsWindowMaximized(window) ? ui::SHOW_STATE_NORMAL |
37 : ui::SHOW_STATE_MAXIMIZED); | 46 : ui::SHOW_STATE_MAXIMIZED); |
38 } | 47 } |
39 | 48 |
| 49 const aura::WindowProperty<bool>* const |
| 50 kWindowTrackedByWorkspaceSplitPropKey = &kWindowTrackedByWorkspaceSplitProp; |
| 51 |
| 52 void SetTrackedByWorkspace(aura::Window* window, bool value) { |
| 53 window->SetProperty(kWindowTrackedByWorkspaceSplitPropKey, value); |
40 } | 54 } |
| 55 |
| 56 bool GetTrackedByWorkspace(aura::Window* window) { |
| 57 return window->GetProperty(kWindowTrackedByWorkspaceSplitPropKey); |
| 58 } |
| 59 |
| 60 } |
OLD | NEW |