blob: e4123543a241d95581415b2b8d8c89cf90e8d4a2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/wm/property_util.h"
#include "ash/wm/window_util.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h"
#include "ui/aura/window_property.h"
#include "ui/base/ui_base_types.h"
#include "ui/gfx/rect.h"
DECLARE_WINDOW_PROPERTY_TYPE(bool)
namespace ash {
namespace {
const aura::WindowProperty<bool> kWindowTrackedByWorkspaceSplitProp = {true};
} // namespace
void SetRestoreBounds(aura::Window* window, const gfx::Rect& bounds) {
window->SetProperty(aura::client::kRestoreBoundsKey, new gfx::Rect(bounds));
}
void SetRestoreBoundsIfNotSet(aura::Window* window) {
if (!GetRestoreBounds(window))
SetRestoreBounds(window, window->bounds());
}
const gfx::Rect* GetRestoreBounds(aura::Window* window) {
return window->GetProperty(aura::client::kRestoreBoundsKey);
}
void ClearRestoreBounds(aura::Window* window) {
window->ClearProperty(aura::client::kRestoreBoundsKey);
}
void ToggleMaximizedState(aura::Window* window) {
window->SetProperty(aura::client::kShowStateKey,
wm::IsWindowMaximized(window) ? ui::SHOW_STATE_NORMAL
: ui::SHOW_STATE_MAXIMIZED);
}
const aura::WindowProperty<bool>* const
kWindowTrackedByWorkspaceSplitPropKey = &kWindowTrackedByWorkspaceSplitProp;
void SetTrackedByWorkspace(aura::Window* window, bool value) {
window->SetProperty(kWindowTrackedByWorkspaceSplitPropKey, value);
}
bool GetTrackedByWorkspace(aura::Window* window) {
return window->GetProperty(kWindowTrackedByWorkspaceSplitPropKey);
}
}
|