Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: components/mus/public/interfaces/window_tree.mojom

Issue 1406153004: components/mus/public/interfaces View => Window (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Yet another rebase Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 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 module mus.mojom;
6
7 import "components/mus/public/interfaces/compositor_frame.mojom";
8 import "components/mus/public/interfaces/surface_id.mojom";
9 import "components/mus/public/interfaces/mus_constants.mojom";
10 import "mojo/application/public/interfaces/service_provider.mojom";
11 import "network/public/interfaces/url_loader.mojom";
12 import "ui/mojo/events/input_events.mojom";
13 import "ui/mojo/ime/text_input_state.mojom";
14 import "ui/mojo/geometry/geometry.mojom";
15
16 struct ViewportMetrics {
17 mojo.Size size_in_pixels;
18 // A value of 0 indicates the real value is not yet available.
19 float device_pixel_ratio = 0.0;
20 };
21
22 struct WindowData {
23 uint32 parent_id;
24 uint32 window_id;
25 mojo.Rect bounds;
26 map<string, array<uint8>> properties;
27 // True if this window is visible. The window may not be drawn on screen (see
28 // drawn for specifics).
29 bool visible;
30 // True if this window is drawn on screen. A window is drawn if attached to
31 // the root and all ancestors (including this window) are visible.
32 bool drawn;
33 ViewportMetrics viewport_metrics;
34 };
35
36 enum ErrorCode {
37 NONE,
38 VALUE_IN_USE,
39 ILLEGAL_ARGUMENT,
40 };
41
42 // Windows are identified by a uint32. The upper 16 bits are the connection id,
43 // and the lower 16 the id assigned by the client.
44 //
45 // The root window is identified with a connection id of 0, and value of 1.
46 interface WindowTree {
47 enum AccessPolicy {
48 DEFAULT = 0,
49
50 // An embed root has the following abilities:
51 // . The app sees all the descendants of the window the app is ebmedded at,
52 // even those from separate connections.
53 // . The app is able to Embed() in all the descendants of the window the app
54 // is embedded at, even those from separate connections.
55 // Only connections originating from the WindowTreeHostFactory can grant
56 // this policy.
57 EMBED_ROOT = 1,
58 };
59
60 // Creates a new window with the specified id. It is up to the client to
61 // ensure the id is unique to the connection (the id need not be globally
62 // unique). Additionally the connection id (embedded in |window_id|) must
63 // match that of the connection.
64 // Errors:
65 // ERROR_CODE_VALUE_IN_USE: a window already exists with the specified id.
66 // ERROR_CODE_ILLEGAL_ARGUMENT: The connection part of |window_id| does not
67 // match the connection id of the client.
68 //
69 // TODO(erg): Once we have default values in mojo, make this take a map of
70 // properties.
71 NewWindow(uint32 window_id) => (ErrorCode error_code);
72
73 // Deletes a window. This does not recurse. No hierarchy change notifications
74 // are sent as a result of this. Only the connection that created the window
75 // can delete it.
76 DeleteWindow(uint32 window_id) => (bool success);
77
78 // Sets the specified bounds of the specified window.
79 SetWindowBounds(uint32 window_id, mojo.Rect bounds) => (bool success);
80
81 // Sets the client area of the specified window. Areas outside the client
82 // area are treated specially.
83 SetClientArea(uint32 window_id, mojo.Rect rect);
84
85 // Sets the visibility of the specified window to |visible|. Connections are
86 // allowed to change the visibility of any window they have created, as well
87 // as any of their roots.
88 SetWindowVisibility(uint32 window_id, bool visible) => (bool success);
89
90 // Sets an individual named property. Setting an individual property to null
91 // deletes the property.
92 SetWindowProperty(uint32 window_id,
93 string name,
94 array<uint8>? value) => (bool success);
95
96 // Requests a Surface for a particular window.
97 RequestSurface(uint32 window_id, Surface& surface, SurfaceClient client);
98
99 // Reparents a window.
100 // This fails for any of the following reasons:
101 // . |parent| or |child| does not identify a valid window.
102 // . |child| is an ancestor of |parent|.
103 // . |child| is already a child of |parent|.
104 //
105 // This may result in a connection getting OnWindowDeleted(). See
106 // RemoveWindowFromParent for details.
107 AddWindow(uint32 parent, uint32 child) => (bool success);
108
109 // Removes a window from its current parent. This fails if the window is not
110 // valid or the window already has no parent.
111 //
112 // Removing a window from a parent may result in OnWindowDeleted() being sent
113 // to other connections. For example, connection A has windows 1 and 2, with 2
114 // a child of 1. Connection B has a root 1. If 2 is removed from 1 then B gets
115 // OnWindowDeleted(). This is done as window 2 is effectively no longer
116 // visible to connection B.
117 RemoveWindowFromParent(uint32 window_id) => (bool success);
118
119 // Reorders a window in its parent, relative to |relative_window_id| according
120 // to |direction|. Only the connection that created the window's parent can
121 // reorder its children.
122 ReorderWindow(uint32 window_id,
123 uint32 relative_window_id,
124 OrderDirection direction) => (bool success);
125
126 // Returns the windows comprising the tree starting at |window_id|.
127 // |window_id| is the first result in the return value, unless |window_id| is
128 // invalid, in which case an empty vector is returned. The windows are visited
129 // using a depth first search (pre-order).
130 GetWindowTree(uint32 window_id) => (array<WindowData> windows);
131
132 // A connection may grant access to another connection by way of Embed().
133 // Embed() results in the supplied WindowTreeClient being configured with a
134 // root window of |window_id|. The supplied WindowTreeClient may create child
135 // windows and do other various tree operations (including Embed()), but does
136 // not see nor have access to any of the windows above the embed point.
137 //
138 // The caller must have created |window_id|. If not the request fails and the
139 // response is false.
140 //
141 // When a connection embeds a WindowTreeClient the originating connection no
142 // longer has privileges to access or see any of the children of the window.
143 // If the window had existing children the children are removed. The one
144 // exception is the root connection and any connections with the policy
145 // ACCESS_POLICY_EMBED_ROOT.
146 //
147 // A window may only have one embedding in it at a time. Subsequent calls to
148 // Embed() for the same window result in the currently embedded
149 // WindowTreeClient being removed. The embedded app is told this by way of
150 // OnUnembed(), which is followed by OnWindowDeleted() (as the connection no
151 // longer has access to the window).
152 //
153 // The embedder can detect when the embedded app disconnects by way of
154 // OnEmbeddedAppDisconnected().
155 //
156 // The callback returns whether the embedding was successful, and if the
157 // embedding was successful and the originating connection is an embed root
158 // the resulting id of the new connection.
159 //
160 // policy_bitmask is a bitmask of the kAccessPolicy constants. See them for
161 // details.
162 Embed(uint32 window_id,
163 WindowTreeClient client,
164 uint32 policy_bitmask) => (bool success, uint16 connection_id);
165
166 SetFocus(uint32 window_id);
167
168 // Set text input state for the given window.
169 SetWindowTextInputState(uint32 window_id, mojo.TextInputState state);
170
171 // Set the input method editor UI (software keyboard, etc) visibility.
172 // If state is non-null, the specified window's text input state is updated.
173 // Otherwise the existing state is used.
174 SetImeVisibility(uint32 window_id, bool visible, mojo.TextInputState? state);
175 };
176
177 // Changes to windows are not sent to the connection that originated the
178 // change. For example, if connection 1 changes the bounds of a window by
179 // calling SetBounds(), connection 1 does not receive OnWindowBoundsChanged().
180 interface WindowTreeClient {
181 // Invoked when the client application has been embedded at |root|.
182 // See Embed() on WindowTree for more details. |tree| will be a handle back to
183 // the window manager service, unless the connection is to the root connection
184 // in which case it will be null.
185 OnEmbed(uint16 connection_id,
186 WindowData root,
187 WindowTree? tree,
188 uint32 focused_window,
189 uint32 access_policy);
190
191 // Invoked when the application embedded at |window| is disconnected. In other
192 // words the embedded app closes the connection to the server. This is called
193 // on the connection that created |window| as well as any ancestors that have
194 // the embed root policy.
195 OnEmbeddedAppDisconnected(uint32 window);
196
197 // Sent when another connection is embedded in the Window this connection was
198 // previously embedded in. See Embed() for more information.
199 OnUnembed();
200
201 // Invoked when a window's bounds have changed.
202 OnWindowBoundsChanged(uint32 window,
203 mojo.Rect old_bounds,
204 mojo.Rect new_bounds);
205
206 OnClientAreaChanged(uint32 window_id,
207 mojo.Rect old_client_area,
208 mojo.Rect new_client_area);
209
210 // Invoked when the viewport metrics for the window have changed.
211 // Clients are expected to propagate this to the window tree.
212 OnWindowViewportMetricsChanged(ViewportMetrics old_metrics,
213 ViewportMetrics new_metrics);
214
215 // Invoked when a change is done to the hierarchy. A value of 0 is used to
216 // identify a null window. For example, if the old_parent is NULL, 0 is
217 // supplied.
218 // |windows| contains any windows that are that the client has not been told
219 // about. This is not sent for hierarchy changes of windows not known to this
220 // client or not attached to the tree.
221 OnWindowHierarchyChanged(uint32 window,
222 uint32 new_parent,
223 uint32 old_parent,
224 array<WindowData> windows);
225
226 // Invoked when the order of windows within a parent changes.
227 OnWindowReordered(uint32 window_id,
228 uint32 relative_window_id,
229 OrderDirection direction);
230
231 // Invoked when a window is deleted.
232 OnWindowDeleted(uint32 window);
233
234 // Invoked when the visibility of the specified window changes.
235 OnWindowVisibilityChanged(uint32 window, bool visible);
236
237 // Invoked when a change to the visibility of |window| or one if it's
238 // ancestors is done such that the drawn state changes. This is only invoked
239 // for the top most window of a particular connection. For example, if you
240 // have the hierarchy: A -> B1 -> B2 (B2 is a child of B1 and B1 a child of
241 // A), B1/B2 are from connection 2 and A from connection 1 with all windows
242 // visible and drawn and the visiblity of A changes to false, then connection
243 // 2 is told the drawn state of B1 has changed (to false), but is not told
244 // anything about B2 as it's drawn state can be calculated from that of B1.
245 //
246 // NOTE: This is not invoked if OnWindowVisibilityChanged() is invoked.
247 OnWindowDrawnStateChanged(uint32 window, bool drawn);
248
249 // Invoked when a window property is changed. If this change is a removal,
250 // |new_data| is null.
251 OnWindowSharedPropertyChanged(uint32 window,
252 string name,
253 array<uint8>? new_data);
254
255 // Invoked when an event is targeted at the specified window.
256 OnWindowInputEvent(uint32 window, mojo.Event event) => ();
257
258 OnWindowFocused(uint32 focused_window_id);
259 };
OLDNEW
« no previous file with comments | « components/mus/public/interfaces/window_manager.mojom ('k') | components/mus/public/interfaces/window_tree_host.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698