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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
ash / public / cpp / shelf_types.h [blame]
// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_PUBLIC_CPP_SHELF_TYPES_H_
#define ASH_PUBLIC_CPP_SHELF_TYPES_H_
#include <cstdint>
#include <ostream>
#include <string>
#include "ash/public/cpp/ash_public_export.h"
namespace ash {
enum class ShelfAlignment {
kBottom,
kLeft,
kRight,
// Top has never been supported.
// The locked alignment is set temporarily and not saved to preferences.
kBottomLocked,
};
enum class HotseatState {
// Hotseat is shown off screen.
kHidden,
// Hotseat is shown within the shelf in clamshell mode.
kShownClamshell,
// Hotseat is shown in the tablet mode home launcher's shelf.
// Compared to kShownClamshell state, in this state, the shelf background is
// not visible behind the hotseat (shelf itself is transparent on the home
// screen). The hotseat also differs in size, and its bounds are moved
// slightly up to leave more space between the hotseat background and the
// bottom of the screen.
kShownHomeLauncher,
// Hotseat is shown above the shelf.
kExtended,
// No value,
kNone
};
// Defines the density of hotseat. Hotseat is "denser" if it can accommodate
// more shelf buttons without scrolling for the given available space.
enum class HotseatDensity { kNormal, kSemiDense, kDense };
enum class ShelfAutoHideBehavior {
kAlways, // Always auto-hide.
kNever, // Never auto-hide.
kAlwaysHidden, // Always hide.
};
enum ShelfAutoHideState {
SHELF_AUTO_HIDE_SHOWN,
SHELF_AUTO_HIDE_HIDDEN,
};
ASH_PUBLIC_EXPORT std::ostream& operator<<(std::ostream& out,
ShelfAlignment alignment);
ASH_PUBLIC_EXPORT std::ostream& operator<<(std::ostream& out,
ShelfAutoHideState state);
enum ShelfVisibilityState {
// Always visible.
SHELF_VISIBLE,
// A couple of pixels are reserved at the bottom for the shelf.
SHELF_AUTO_HIDE,
// Nothing is shown. Used for fullscreen windows.
SHELF_HIDDEN,
};
enum class ShelfBackgroundType {
// The default transparent background.
kDefaultBg,
// The background when a window is maximized or two windows are maximized
// for a split view.
kMaximized,
// The background when the app list is visible in tablet mode.
kHomeLauncher,
// The background when OOBE is active.
kOobe,
// The background when login/lock/user-add is active.
kLogin,
// The background when login/lock/user-add is active and the wallpaper is not
// blurred.
kLoginNonBlurredWallpaper,
// The background when overview is active.
kOverview,
// The background for the in-app shelf in tablet mode.
kInApp,
};
ASH_PUBLIC_EXPORT std::ostream& operator<<(std::ostream& out,
ShelfBackgroundType type);
// Source of the launch or activation request, for tracking.
enum ShelfLaunchSource {
// The item was launched from an unknown source.
LAUNCH_FROM_UNKNOWN = 0,
// The item was launched from a generic app list view.
LAUNCH_FROM_APP_LIST = 1,
// The item was launched from an app list search view.
LAUNCH_FROM_APP_LIST_SEARCH = 2,
// The item was launched from an app list search Recommendation.
LAUNCH_FROM_APP_LIST_RECOMMENDATION = 3,
// The item was launched from the shelf itself.
LAUNCH_FROM_SHELF = 4,
// The item was launched internally, for example from test.
LAUNCH_FROM_INTERNAL = 5,
};
// The actions that may be performed when a shelf item is selected.
enum ShelfAction {
// No action was taken.
SHELF_ACTION_NONE,
// A new window was created.
SHELF_ACTION_NEW_WINDOW_CREATED,
// An existing inactive window was activated.
SHELF_ACTION_WINDOW_ACTIVATED,
// The currently active window was minimized.
SHELF_ACTION_WINDOW_MINIMIZED,
// The app list launcher menu was shown.
SHELF_ACTION_APP_LIST_SHOWN,
// The app list launcher menu was dismissed.
SHELF_ACTION_APP_LIST_DISMISSED,
// The back action was performed on the app list.
SHELF_ACTION_APP_LIST_BACK,
};
// The type of a shelf item.
enum ShelfItemType {
// Represents a pinned shortcut to an app, the app may be running or not.
TYPE_PINNED_APP,
// The browser shortcut button, the browser may be running or not.
TYPE_BROWSER_SHORTCUT,
// Represents an unpinned running app window. Supports these app types:
// - Extension "V1" (legacy packaged and hosted) apps,
// - Extension "V2" (platform) apps,
// - ARC (App Runtime for Chrome - Android Play Store) apps.
// - Lacros.
TYPE_APP,
// Similar to TYPE_BROWSER_SHORTCUT, but not pinned.
// This is for the Lacros migration.
// After Lacros is completely made, TYPE_BROWSER_SHORTCUT and
// TYPE_UNPINNED_BROWSER_SHORTCUT will be removed, eventually.
TYPE_UNPINNED_BROWSER_SHORTCUT,
// Represents an open dialog.
TYPE_DIALOG,
// Default value.
TYPE_UNDEFINED,
};
// Returns true if |type| is a valid ShelfItemType.
ASH_PUBLIC_EXPORT bool IsValidShelfItemType(int64_t type);
// Returns true if |type| is a pinned type (i.e. not a running app or dialog).
ASH_PUBLIC_EXPORT bool IsPinnedShelfItemType(ShelfItemType type);
// Returns true if types |a| and |b| have the same pin state, i.e. if they
// are both pinned apps (or a browser shortcut which is always pinned) or both
// unpinned apps. Returns false if either a or b aren't an app type.
ASH_PUBLIC_EXPORT bool SamePinState(ShelfItemType a, ShelfItemType b);
// Represents the status of applications in the shelf.
enum ShelfItemStatus {
// A closed shelf item, i.e. has no live instance.
STATUS_CLOSED,
// A shelf item that has live instance.
STATUS_RUNNING,
// A shelf item that needs user's attention.
STATUS_ATTENTION,
};
// Represents the app status in the shelf or app_list.
enum AppStatus {
// The app is ready.
kReady,
// The app is blocked.
kBlocked,
// The app is paused.
kPaused,
// (For promise apps only) The promise app is pending installation.
kPending,
// (For promise apps only) The promise app is currently downloading/
// installing.
kInstalling,
// (For promise apps only) The promise app is finished downloading/
// installing.
kInstallSuccess,
// (For promise apps only) The promise app installing is cancelled.
kInstallCancelled,
};
// A unique shelf item id composed of an |app_id| and a |launch_id|.
// |app_id| is the non-empty application id associated with a set of windows.
// |launch_id| is passed on app launch, to support multiple shelf items per app.
// As an example, a remote desktop client may want each remote application to
// have its own icon.
struct ASH_PUBLIC_EXPORT ShelfID {
explicit ShelfID(const std::string& app_id = std::string(),
const std::string& launch_id = std::string());
~ShelfID();
ShelfID(const ShelfID& other);
ShelfID(ShelfID&& other);
ShelfID& operator=(const ShelfID& other);
bool operator==(const ShelfID& other) const;
bool operator!=(const ShelfID& other) const;
bool operator<(const ShelfID& other) const;
// Returns true if both the application id and launch id are empty.
// This is often used to determine if the id is invalid.
bool IsNull() const;
// Functions to [de]serialize ids as a string for window property usage, etc.
// Serialization appends ids with a delimeter that must not be used in ids.
// Deserialization returns an empty/null/default id for a null string input.
std::string Serialize() const;
static ShelfID Deserialize(const std::string* string);
// The application id associated with a set of windows.
std::string app_id;
// An id passed on app launch, to support multiple shelf items per app.
std::string launch_id;
};
ASH_PUBLIC_EXPORT std::ostream& operator<<(std::ostream& o, const ShelfID& id);
} // namespace ash
#endif // ASH_PUBLIC_CPP_SHELF_TYPES_H_