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

Side by Side Diff: mojo/services/public/interfaces/view_manager/view_manager.mojom

Issue 397263004: Nukes change_ids from view manager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 import "mojo/services/public/interfaces/geometry/geometry.mojom" 5 import "mojo/services/public/interfaces/geometry/geometry.mojom"
6 import "mojo/services/public/interfaces/input_events/input_events.mojom" 6 import "mojo/services/public/interfaces/input_events/input_events.mojom"
7 import "mojo/services/public/interfaces/view_manager/view_manager_constants.mojo m" 7 import "mojo/services/public/interfaces/view_manager/view_manager_constants.mojo m"
8 8
9 module mojo.view_manager { 9 module mojo.view_manager {
10 10
11 struct NodeData { 11 struct NodeData {
12 uint32 parent_id; 12 uint32 parent_id;
13 uint32 node_id; 13 uint32 node_id;
14 uint32 view_id; 14 uint32 view_id;
15 mojo.Rect bounds; 15 mojo.Rect bounds;
16 // TODO(sky): add visible. 16 // TODO(sky): add visible.
17 }; 17 };
18 18
19 enum ErrorCode { 19 enum ErrorCode {
20 NONE, 20 NONE,
21 VALUE_IN_USE, 21 VALUE_IN_USE,
22 ILLEGAL_ARGUMENT, 22 ILLEGAL_ARGUMENT,
23 UNEXPECTED_CHANGE_ID,
24 }; 23 };
25 24
26 // ViewManagerInitService is responsible for launching the client that controls 25 // ViewManagerInitService is responsible for launching the client that controls
27 // the root node. mojo::view_manager returns an instance of this. All other 26 // the root node. mojo::view_manager returns an instance of this. All other
28 // connections are established by the client this creates. 27 // connections are established by the client this creates.
29 interface ViewManagerInitService { 28 interface ViewManagerInitService {
30 EmbedRoot(string url) => (bool success); 29 EmbedRoot(string url) => (bool success);
31 }; 30 };
32 31
33 // Functions that mutate the hierarchy take a change id. This is an ever
34 // increasing integer used to identify the change. Every hierarchy change
35 // increases this value. The server only accepts changes where the supplied
36 // |server_change_id| matches the expected next value. This ensures changes are
37 // made in a well defined order.
38 //
39 // Nodes and Views are identified by a uint32. The upper 16 bits are the 32 // Nodes and Views are identified by a uint32. The upper 16 bits are the
40 // connection id, and the lower 16 the id assigned by the client. 33 // connection id, and the lower 16 the id assigned by the client.
41 // 34 //
42 // The root node is identified with a connection id of 0, and value of 1. 35 // The root node is identified with a connection id of 0, and value of 1.
43 [Client=ViewManagerClient] 36 [Client=ViewManagerClient]
44 interface ViewManagerService { 37 interface ViewManagerService {
45 // Creates a new node with the specified id. It is up to the client to ensure 38 // Creates a new node with the specified id. It is up to the client to ensure
46 // the id is unique to the connection (the id need not be globally unique). 39 // the id is unique to the connection (the id need not be globally unique).
47 // Additionally the connection id (embedded in |node_id|) must match that of 40 // Additionally the connection id (embedded in |node_id|) must match that of
48 // the connection. 41 // the connection.
49 // Errors: 42 // Errors:
50 // ERROR_CODE_VALUE_IN_USE: a node already exists with the specified id. 43 // ERROR_CODE_VALUE_IN_USE: a node already exists with the specified id.
51 // ERROR_CODE_ILLEGAL_ARGUMENT: The connection part of |node_id| does not 44 // ERROR_CODE_ILLEGAL_ARGUMENT: The connection part of |node_id| does not
52 // match the connection id of the client. 45 // match the connection id of the client.
53 CreateNode(uint32 node_id) => (ErrorCode error_code); 46 CreateNode(uint32 node_id) => (ErrorCode error_code);
54 47
55 // Deletes a node. This does not recurse. No hierarchy change notifications 48 // Deletes a node. This does not recurse. No hierarchy change notifications
56 // are sent as a result of this. Only the connection that created the node can 49 // are sent as a result of this. Only the connection that created the node can
57 // delete it. 50 // delete it.
58 DeleteNode(uint32 node_id, uint32 change_id) => (bool success); 51 DeleteNode(uint32 node_id) => (bool success);
59 52
60 // Sets the specified bounds of the specified node. 53 // Sets the specified bounds of the specified node.
61 SetNodeBounds(uint32 node_id, mojo.Rect bounds) => (bool success); 54 SetNodeBounds(uint32 node_id, mojo.Rect bounds) => (bool success);
62 55
63 // Sets the visibility of the specified node to |visible|. Connections are 56 // Sets the visibility of the specified node to |visible|. Connections are
64 // allowed to change the visibility of any node they have created, as well as 57 // allowed to change the visibility of any node they have created, as well as
65 // any of their roots. 58 // any of their roots.
66 SetNodeVisibility(uint32 node_id, bool visible) => (bool success); 59 SetNodeVisibility(uint32 node_id, bool visible) => (bool success);
67 60
68 // Reparents a node. See description above class for details of |change_id|. 61 // Reparents a node.
69 // This fails for any of the following reasons: 62 // This fails for any of the following reasons:
70 // . |server_change_id| is not the expected id.
71 // . |parent| or |child| does not identify a valid node. 63 // . |parent| or |child| does not identify a valid node.
72 // . |child| is an ancestor of |parent|. 64 // . |child| is an ancestor of |parent|.
73 // . |child| is already a child of |parent|. 65 // . |child| is already a child of |parent|.
74 // 66 //
75 // This may result in a connection getting OnNodeDeleted(). See 67 // This may result in a connection getting OnNodeDeleted(). See
76 // RemoveNodeFromParent for details. 68 // RemoveNodeFromParent for details.
77 AddNode(uint32 parent, 69 AddNode(uint32 parent, uint32 child) => (bool success);
78 uint32 child,
79 uint32 server_change_id) => (bool success);
80 70
81 // Removes a view from its current parent. See description above class for 71 // Removes a view from its current parent. This fails if the node is not
82 // details of |change_id|. This fails if the node is not valid, 72 // valid, |server_change_id| doesn't match, or the node already has no parent.
83 // |server_change_id| doesn't match, or the node already has no parent.
84 // 73 //
85 // Removing a node from a parent may result in OnNodeDeleted() being sent to 74 // Removing a node from a parent may result in OnNodeDeleted() being sent to
86 // other connections. For example, connection A has nodes 1 and 2, with 2 a 75 // other connections. For example, connection A has nodes 1 and 2, with 2 a
87 // child of 1. Connection B has a root 1. If 2 is removed from 1 then B gets 76 // child of 1. Connection B has a root 1. If 2 is removed from 1 then B gets
88 // OnNodeDeleted(). This is done as node 2 is effectively no longer visible to 77 // OnNodeDeleted(). This is done as node 2 is effectively no longer visible to
89 // connection B. 78 // connection B.
90 RemoveNodeFromParent(uint32 node_id, 79 RemoveNodeFromParent(uint32 node_id) => (bool success);
91 uint32 server_change_id) => (bool success);
92 80
93 // Reorders a node in its parent, relative to |relative_node_id| according to 81 // Reorders a node in its parent, relative to |relative_node_id| according to
94 // |direction|. 82 // |direction|.
95 // Only the connection that created the node's parent can reorder its 83 // Only the connection that created the node's parent can reorder its
96 // children. 84 // children.
97 ReorderNode(uint32 node_id, 85 ReorderNode(uint32 node_id,
98 uint32 relative_node_id, 86 uint32 relative_node_id,
99 OrderDirection direction, 87 OrderDirection direction) => (bool success);
100 uint32 server_change_id) => (bool success);
101 88
102 // Returns the nodes comprising the tree starting at |node_id|. |node_id| is 89 // Returns the nodes comprising the tree starting at |node_id|. |node_id| is
103 // the first result in the return value, unless |node_id| is invalid, in which 90 // the first result in the return value, unless |node_id| is invalid, in which
104 // case an empty vector is returned. The nodes are visited using a depth first 91 // case an empty vector is returned. The nodes are visited using a depth first
105 // search (pre-order). 92 // search (pre-order).
106 GetNodeTree(uint32 node_id) => (NodeData[] nodes); 93 GetNodeTree(uint32 node_id) => (NodeData[] nodes);
107 94
108 // Creates a new view with the specified id. It is up to the client to ensure 95 // Creates a new view with the specified id. It is up to the client to ensure
109 // the id is unique to the connection (the id need not be globally unique). 96 // the id is unique to the connection (the id need not be globally unique).
110 // Additionally the connection id (embedded in |view_id|) must match that of 97 // Additionally the connection id (embedded in |view_id|) must match that of
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 // Sends OnViewInputEvent() to the owner of the specified view. 135 // Sends OnViewInputEvent() to the owner of the specified view.
149 DispatchOnViewInputEvent(uint32 view_id, mojo.Event event); 136 DispatchOnViewInputEvent(uint32 view_id, mojo.Event event);
150 }; 137 };
151 138
152 // Changes to nodes/views are not sent to the connection that originated the 139 // Changes to nodes/views are not sent to the connection that originated the
153 // change. For example, if connection 1 attaches a view to a node (SetView()) 140 // change. For example, if connection 1 attaches a view to a node (SetView())
154 // connection 1 does not receive OnNodeViewReplaced(). 141 // connection 1 does not receive OnNodeViewReplaced().
155 [Client=ViewManagerService] 142 [Client=ViewManagerService]
156 interface ViewManagerClient { 143 interface ViewManagerClient {
157 // Invoked once the connection has been established. |connection_id| is the id 144 // Invoked once the connection has been established. |connection_id| is the id
158 // that uniquely identifies this connection. |next_server_change_id| is the 145 // that uniquely identifies this connection. |nodes| are the nodes parented to
159 // id of the next change the server is expecting. |nodes| are the nodes 146 // the root.
160 // parented to the root.
161 OnViewManagerConnectionEstablished(uint16 connection_id, 147 OnViewManagerConnectionEstablished(uint16 connection_id,
162 string creator_url, 148 string creator_url,
163 uint32 next_server_change_id,
164 NodeData[] nodes); 149 NodeData[] nodes);
165 150
166 // See description of ViewManagerService::Embed() for details as to when 151 // See description of ViewManagerService::Embed() for details as to when
167 // this is invoked. 152 // this is invoked.
168 OnRootAdded(NodeData[] nodes); 153 OnRootAdded(NodeData[] nodes);
169 154
170 // This is sent to clients when a change is made to the server that results
171 // in the |server_change_id| changing but the client isn't notified. This is
172 // not sent if the client receives a callback giving a new
173 // |server_change_id|. For example, if a client 1 changes the hierarchy in
174 // some way but client 2 isn't notified of the change, then client 2 gets
175 // OnServerChangeIdAdvanced().
176 OnServerChangeIdAdvanced(uint32 next_server_change_id);
177
178 // Invoked when a node's bounds have changed. 155 // Invoked when a node's bounds have changed.
179 OnNodeBoundsChanged(uint32 node, mojo.Rect old_bounds, mojo.Rect new_bounds); 156 OnNodeBoundsChanged(uint32 node, mojo.Rect old_bounds, mojo.Rect new_bounds);
180 157
181 // Invoked when a change is done to the hierarchy. A value of 0 is used to 158 // Invoked when a change is done to the hierarchy. A value of 0 is used to
182 // identify a null node. For example, if the old_parent is NULL, 0 is 159 // identify a null node. For example, if the old_parent is NULL, 0 is
183 // supplied. See description above ViewManager for details on the change ids. 160 // supplied. See description above ViewManager for details on the change ids.
184 // |nodes| contains any nodes that are that the client has not been told 161 // |nodes| contains any nodes that are that the client has not been told
185 // about. This is not sent for hierarchy changes of nodes not known to this 162 // about. This is not sent for hierarchy changes of nodes not known to this
186 // client or not attached to the tree. 163 // client or not attached to the tree.
187 OnNodeHierarchyChanged(uint32 node, 164 OnNodeHierarchyChanged(uint32 node,
188 uint32 new_parent, 165 uint32 new_parent,
189 uint32 old_parent, 166 uint32 old_parent,
190 uint32 server_change_id,
191 NodeData[] nodes); 167 NodeData[] nodes);
192 168
193 // Invoked when the order of nodes within a parent changes. 169 // Invoked when the order of nodes within a parent changes.
194 OnNodeReordered(uint32 node_id, 170 OnNodeReordered(uint32 node_id,
195 uint32 relative_node_id, 171 uint32 relative_node_id,
196 OrderDirection direction, 172 OrderDirection direction);
197 uint32 server_change_id);
198 173
199 // Invoked when a node is deleted. 174 // Invoked when a node is deleted.
200 OnNodeDeleted(uint32 node, uint32 server_change_id); 175 OnNodeDeleted(uint32 node);
201 176
202 // Invoked when the view associated with a node is replaced by another view. 177 // Invoked when the view associated with a node is replaced by another view.
203 // 0 is used to identify a null view. 178 // 0 is used to identify a null view.
204 OnNodeViewReplaced(uint32 node, uint32 new_view_id, uint32 old_view_id); 179 OnNodeViewReplaced(uint32 node, uint32 new_view_id, uint32 old_view_id);
205 180
206 // Invoked when a view is deleted. 181 // Invoked when a view is deleted.
207 OnViewDeleted(uint32 view); 182 OnViewDeleted(uint32 view);
208 183
209 // Invoked when an event is targeted at the specified view. 184 // Invoked when an event is targeted at the specified view.
210 OnViewInputEvent(uint32 view, mojo.Event event) => (); 185 OnViewInputEvent(uint32 view, mojo.Event event) => ();
211 186
212 // Invoked when focus shifts from one Node to another. |gained_focus_id| is 187 // Invoked when focus shifts from one Node to another. |gained_focus_id| is
213 // the id of the node that gained focus, or 0 if the node that gained focus is 188 // the id of the node that gained focus, or 0 if the node that gained focus is
214 // not known to this connection. |lost_focus_id| is likewise the node that 189 // not known to this connection. |lost_focus_id| is likewise the node that
215 // lost focus. 190 // lost focus.
216 // TODO(beng): once aura is removed from the service, focus management should 191 // TODO(beng): once aura is removed from the service, focus management should
217 // entirely move to the window manager and this method can be 192 // entirely move to the window manager and this method can be
218 // removed. 193 // removed.
219 OnFocusChanged(uint32 gained_focus_id, uint32 lost_focus_id); 194 OnFocusChanged(uint32 gained_focus_id, uint32 lost_focus_id);
220 195
221 // TODO(sky): move to separate interface when FIFO sorted out. 196 // TODO(sky): move to separate interface when FIFO sorted out.
222 197
223 DispatchOnViewInputEvent(uint32 view, mojo.Event event); 198 DispatchOnViewInputEvent(uint32 view, mojo.Event event);
224 }; 199 };
225 200
226 } 201 }
OLDNEW
« no previous file with comments | « mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.cc ('k') | mojo/services/view_manager/root_node_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698