1 // Copyright 2018 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 #ifndef UI_PLATFORM_WINDOW_PLATFORM_WINDOW_INIT_PROPERTIES_H_
6 #define UI_PLATFORM_WINDOW_PLATFORM_WINDOW_INIT_PROPERTIES_H_
7
8 #include <string>
9
10 #include "base/component_export.h"
11 #include "base/optional.h"
12 #include "build/build_config.h"
13 #include "ui/gfx/geometry/rect.h"
14 #include "ui/gfx/native_widget_types.h"
15
16 #if defined(OS_FUCHSIA)
17 #include <fuchsia/ui/views/cpp/fidl.h>
18 #include <lib/ui/scenic/cpp/view_ref_pair.h>
19 #endif
20
21 namespace gfx {
22 class ImageSkia;
23 }
24
25 namespace ui {
26
27 enum class PlatformWindowType {
28 kWindow,
29 kPopup,
30 kMenu,
31 kTooltip,
32 kDrag,
33 kBubble,
34 };
35
36 enum class PlatformWindowOpacity {
37 kInferOpacity,
38 kOpaqueWindow,
39 kTranslucentWindow,
40 };
41
42 class WorkspaceExtensionDelegate;
43
44 #if defined(OS_LINUX) || defined(OS_BSD)
45 class X11ExtensionDelegate;
46 #endif
47
48 // Initial properties which are passed to PlatformWindow to be initialized
49 // with a desired set of properties.
COMPONENT_EXPORT(PLATFORM_WINDOW)50 struct COMPONENT_EXPORT(PLATFORM_WINDOW) PlatformWindowInitProperties {
51 PlatformWindowInitProperties();
52
53 // Initializes properties with the specified |bounds|.
54 explicit PlatformWindowInitProperties(const gfx::Rect& bounds);
55
56 PlatformWindowInitProperties(PlatformWindowInitProperties&& props);
57
58 ~PlatformWindowInitProperties();
59
60 // Tells desired PlatformWindow type. It can be popup, menu or anything else.
61 PlatformWindowType type = PlatformWindowType::kWindow;
62 // Sets the desired initial bounds. Can be empty.
63 gfx::Rect bounds;
64 // Tells PlatformWindow which native widget its parent holds. It is usually
65 // used to find a parent from internal list of PlatformWindows.
66 gfx::AcceleratedWidget parent_widget = gfx::kNullAcceleratedWidget;
67 // Tells the opacity type of a window. Check the comment in the
68 // Widget::InitProperties::WindowOpacity.
69 PlatformWindowOpacity opacity = PlatformWindowOpacity::kOpaqueWindow;
70
71 #if defined(OS_FUCHSIA)
72 fuchsia::ui::views::ViewToken view_token;
73 scenic::ViewRefPair view_ref_pair;
74 #endif
75
76 bool activatable = true;
77 bool force_show_in_taskbar;
78 bool keep_on_top = false;
79 bool visible_on_all_workspaces = false;
80 bool remove_standard_frame = false;
81 std::string workspace;
82
83 WorkspaceExtensionDelegate* workspace_extension_delegate = nullptr;
84
85 #if defined(OS_LINUX) || defined(OS_BSD)
86 bool prefer_dark_theme = false;
87 gfx::ImageSkia* icon = nullptr;
88 base::Optional<int> background_color;
89
90 // Specifies the res_name and res_class fields,
91 // respectively, of the WM_CLASS window property. Controls window grouping
92 // and desktop file matching in Linux window managers.
93 std::string wm_role_name;
94 std::string wm_class_name;
95 std::string wm_class_class;
96
97 X11ExtensionDelegate* x11_extension_delegate = nullptr;
98 #endif
99 };
100
101 } // namespace ui
102
103 #endif // UI_PLATFORM_WINDOW_PLATFORM_WINDOW_INIT_PROPERTIES_H_
104