forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproperty_util.h
77 lines (57 loc) · 2.24 KB
/
property_util.h
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Copyright 2015 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.
#ifndef ASH_MUS_PROPERTY_UTIL_H_
#define ASH_MUS_PROPERTY_UTIL_H_
#include <stdint.h>
#include <map>
#include <string>
#include <vector>
namespace aura {
class PropertyConverter;
class Window;
}
namespace gfx {
class Rect;
class Size;
}
namespace ui {
namespace mojom {
enum class WindowType;
}
}
namespace ash {
namespace mojom {
enum class WindowStyle;
}
namespace mus {
// Functions for extracting properties that are used at a Window creation time.
// When an aura::Window is created at the request of a client an initial set of
// properties is supplied to allow the WindowManager (ash) to configure the
// newly created window. Not all of these properties need be persisted, some are
// used solely to configure the window. This file contains the functions used
// to extract these properties.
// Long lived properties are converted and stored as properties on the
// associated aura::Window. See aura::PropertyConverter for this set of
// properties.
using InitProperties = std::map<std::string, std::vector<uint8_t>>;
// Returns the kDisplayId_InitProperty if present, otherwise
// kInvalidDisplayID.
int64_t GetInitialDisplayId(const InitProperties& properties);
// If |window| has the |kContainerId_InitProperty| set as a property, then
// the value of |kContainerId_InitProperty| is set in |container_id| and true
// is returned. Otherwise false is returned.
bool GetInitialContainerId(const InitProperties& properties, int* container_id);
bool GetInitialBounds(const InitProperties& properties, gfx::Rect* bounds);
bool GetWindowPreferredSize(const InitProperties& properties, gfx::Size* size);
bool ShouldRemoveStandardFrame(const InitProperties& properties);
bool ShouldEnableImmersive(const InitProperties& properties);
mojom::WindowStyle GetWindowStyle(const InitProperties& properties);
// Applies |properties| to |window| using |property_converter|.
void ApplyProperties(
aura::Window* window,
aura::PropertyConverter* property_converter,
const std::map<std::string, std::vector<uint8_t>>& properties);
} // namespace mus
} // namespace ash
#endif // ASH_MUS_PROPERTY_UTIL_H_