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

Side by Side Diff: third_party/mojo_services/src/view_manager/public/interfaces/view_manager.mojom

Issue 1085233004: Moves services implementations out of third_party/mojo_services (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unnecessary changes Created 5 years, 8 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 mojo;
6
7 import "geometry/public/interfaces/geometry.mojom";
8 import "input_events/public/interfaces/input_events.mojom";
9 import "mojo/public/interfaces/application/service_provider.mojom";
10 import "native_viewport/public/interfaces/native_viewport.mojom";
11 import "surfaces/public/interfaces/surface_id.mojom";
12 import "view_manager/public/interfaces/view_manager_constants.mojom";
13
14 struct ViewData {
15 uint32 parent_id;
16 uint32 view_id;
17 mojo.Rect bounds;
18 map<string, array<uint8>> properties;
19 // True if this view is visible. The view may not be drawn on screen (see
20 // drawn for specifics).
21 bool visible;
22 // True if this view is drawn on screen. A view is drawn if attached to the
23 // root and all ancestors (including this view) are visible.
24 bool drawn;
25 ViewportMetrics viewport_metrics;
26 };
27
28 enum ErrorCode {
29 NONE,
30 VALUE_IN_USE,
31 ILLEGAL_ARGUMENT,
32 };
33
34 // Views are identified by a uint32. The upper 16 bits are the connection id,
35 // and the lower 16 the id assigned by the client.
36 //
37 // The root view is identified with a connection id of 0, and value of 1.
38 interface ViewManagerService {
39 // Creates a new view with the specified id. It is up to the client to ensure
40 // the id is unique to the connection (the id need not be globally unique).
41 // Additionally the connection id (embedded in |view_id|) must match that of
42 // the connection.
43 // Errors:
44 // ERROR_CODE_VALUE_IN_USE: a view already exists with the specified id.
45 // ERROR_CODE_ILLEGAL_ARGUMENT: The connection part of |view_id| does not
46 // match the connection id of the client.
47 //
48 // TODO(erg): Once we have default values in mojo, make this take a map of
49 // properties.
50 CreateView(uint32 view_id) => (ErrorCode error_code);
51
52 // Deletes a view. This does not recurse. No hierarchy change notifications
53 // are sent as a result of this. Only the connection that created the view can
54 // delete it.
55 DeleteView(uint32 view_id) => (bool success);
56
57 // Sets the specified bounds of the specified view.
58 SetViewBounds(uint32 view_id, mojo.Rect bounds) => (bool success);
59
60 // Sets the visibility of the specified view to |visible|. Connections are
61 // allowed to change the visibility of any view they have created, as well as
62 // any of their roots.
63 SetViewVisibility(uint32 view_id, bool visible) => (bool success);
64
65 // Sets an individual named property. Setting an individual property to null
66 // deletes the property.
67 SetViewProperty(uint32 view_id,
68 string name,
69 array<uint8>? value) => (bool success);
70
71 // Reparents a view.
72 // This fails for any of the following reasons:
73 // . |parent| or |child| does not identify a valid view.
74 // . |child| is an ancestor of |parent|.
75 // . |child| is already a child of |parent|.
76 //
77 // This may result in a connection getting OnViewDeleted(). See
78 // RemoveViewFromParent for details.
79 AddView(uint32 parent, uint32 child) => (bool success);
80
81 // Removes a view from its current parent. This fails if the view is not
82 // valid or the view already has no parent.
83 //
84 // Removing a view from a parent may result in OnViewDeleted() being sent to
85 // other connections. For example, connection A has views 1 and 2, with 2 a
86 // child of 1. Connection B has a root 1. If 2 is removed from 1 then B gets
87 // OnViewDeleted(). This is done as view 2 is effectively no longer visible to
88 // connection B.
89 RemoveViewFromParent(uint32 view_id) => (bool success);
90
91 // Reorders a view in its parent, relative to |relative_view_id| according to
92 // |direction|.
93 // Only the connection that created the view's parent can reorder its
94 // children.
95 ReorderView(uint32 view_id,
96 uint32 relative_view_id,
97 OrderDirection direction) => (bool success);
98
99 // Returns the views comprising the tree starting at |view_id|. |view_id| is
100 // the first result in the return value, unless |view_id| is invalid, in which
101 // case an empty vector is returned. The views are visited using a depth first
102 // search (pre-order).
103 GetViewTree(uint32 view_id) => (array<ViewData> views);
104
105 // Shows the surface in the specified view.
106 SetViewSurfaceId(uint32 view_id, SurfaceId surface_id) => (bool success);
107
108 // A connection may grant access to a view from another connection by way of
109 // the embed functions. There are two variants of this call:
110 //
111 // . EmbedUrl: the ViewManager connects to the app at the supplied url and
112 // asks it for a ViewManagerClient.
113 // . With the second variant a ViewManagerClient is directly supplied.
114 //
115 // In both cases the new ViewManagerClient is configured with a root of
116 // |view_id|.
117 //
118 // The caller must have created |view_id|. If not the request fails and the
119 // response is false.
120 //
121 // A view may only be a root of one connection at a time. Subsequent calls to
122 // Embed() for the same view result in the view being removed from the
123 // currently embedded app. The embedded app is told this by way of
124 // OnViewDeleted().
125 //
126 // The embedder can detect when the embedded app disconnects by way of
127 // OnEmbeddedAppDisconnected().
128 //
129 // When a connection embeds an app the connection no longer has priviledges
130 // to access or see any of the children of the view. If the view had existing
131 // children the children are removed. The one exception is the root
132 // connection.
133 //
134 // |services| encapsulates services offered by the embedder to the embedded
135 // app alongside this Embed() call. |exposed_services| provides a means for
136 // the embedder to connect to services exposed by the embedded app. Note that
137 // if a different app is subsequently embedded at |view_id| the
138 // ServiceProvider connections to its client in the embedded app and any
139 // services it provided are not broken and continue to be valid.
140 EmbedUrl(string url,
141 uint32 view_id,
142 ServiceProvider&? services,
143 ServiceProvider? exposed_services) => (bool success);
144 Embed(uint32 view_id, ViewManagerClient client) => (bool success);
145
146 // Requests the WindowManager to perform an action on the specified view.
147 // It's up to the WindowManager to decide what |action| is.
148 //
149 // TODO(sky): nuke this. This is here to guarantee the state of the
150 // WindowManager matches that of the ViewManager at the time the client
151 // invokes the function. When we can enforce ordering this won't be necessary.
152 PerformAction(uint32 view_id, string action) => (bool success);
153 };
154
155 // Changes to views are not sent to the connection that originated the
156 // change. For example, if connection 1 changes the bounds of a view by calling
157 // SetBounds(), connection 1 does not receive OnViewBoundsChanged().
158 interface ViewManagerClient {
159 // Invoked when the client application has been embedded at |root|.
160 // See Embed() on ViewManagerService for more details. |view_manager_service|
161 // will be a handle back to the view manager service, unless the connection is
162 // to the WindowManager in which case it will be null.
163 // |window_manager_pipe| is a pipe to the WindowManager.
164 OnEmbed(uint16 connection_id,
165 string embedder_url,
166 ViewData root,
167 ViewManagerService? view_manager_service,
168 ServiceProvider&? services,
169 ServiceProvider? exposed_services,
170 handle<message_pipe> window_manager_pipe);
171
172 // Invoked when the application embedded at |view| is disconnected.
173 OnEmbeddedAppDisconnected(uint32 view);
174
175 // Invoked when a view's bounds have changed.
176 OnViewBoundsChanged(uint32 view,
177 mojo.Rect old_bounds,
178 mojo.Rect new_bounds);
179
180 // Invoked when the viewport metrics for the view have changed.
181 // Clients are expected to propagate this to the view tree.
182 OnViewViewportMetricsChanged(mojo.ViewportMetrics old_metrics,
183 mojo.ViewportMetrics new_metrics);
184
185 // Invoked when a change is done to the hierarchy. A value of 0 is used to
186 // identify a null view. For example, if the old_parent is NULL, 0 is
187 // supplied.
188 // |views| contains any views that are that the client has not been told
189 // about. This is not sent for hierarchy changes of views not known to this
190 // client or not attached to the tree.
191 OnViewHierarchyChanged(uint32 view,
192 uint32 new_parent,
193 uint32 old_parent,
194 array<ViewData> views);
195
196 // Invoked when the order of views within a parent changes.
197 OnViewReordered(uint32 view_id,
198 uint32 relative_view_id,
199 OrderDirection direction);
200
201 // Invoked when a view is deleted.
202 OnViewDeleted(uint32 view);
203
204 // Invoked when the visibility of the specified view changes.
205 OnViewVisibilityChanged(uint32 view, bool visible);
206
207 // Invoked when a change to the visibility of |view| or one if it's ancestors
208 // is done such that the drawn state changes. This is only invoked for the
209 // top most view of a particular connection. For example, if you have the
210 // hierarchy: A -> B1 -> B2 (B2 is a child of B1 and B1 a child of A), B1/B2
211 // are from connection 2 and A from connection 1 with all views visible and
212 // drawn and the visiblity of A changes to false, then connection 2 is told
213 // the drawn state of B1 has changed (to false), but is not told anything
214 // about B2 as it's drawn state can be calculated from that of B1.
215 //
216 // NOTE: This is not invoked if OnViewVisibilityChanged() is invoked.
217 OnViewDrawnStateChanged(uint32 view, bool drawn);
218
219 // Invoked when a view property is changed. If this change is a removal,
220 // |new_data| is null.
221 OnViewSharedPropertyChanged(uint32 view, string name, array<uint8>? new_data);
222
223 // Invoked when an event is targeted at the specified view.
224 OnViewInputEvent(uint32 view, mojo.Event event) => ();
225
226 // Invoked solely on the WindowManager. See comments in PerformAction() above
227 // for details.
228 // TODO(sky): nuke this.
229 OnPerformAction(uint32 view_id, string action) => (bool success);
230 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698