OLD | NEW |
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 module mojo.services.view_manager { | 5 module mojo.services.view_manager { |
6 | 6 |
7 // Functions that mutate the hierarchy take a |change_id|. |change_id| is an | 7 // Functions that mutate the hierarchy take a |change_id|. |change_id| is an |
8 // arbitrary value assigned by the client originating the change. It may be | 8 // arbitrary value assigned by the client originating the change. It may be |
9 // used by the client originating the change to later identify the change in | 9 // used by the client originating the change to later identify the change in |
10 // an OnNodeHierarchyChanged callback. |change_id| is only passed to the client | 10 // an OnNodeHierarchyChanged callback. |change_id| is only passed to the client |
11 // that originated the change; all other clients get a value of 0. | 11 // that originated the change; all other clients get a value of 0. |
12 // | 12 // |
13 // Nodes are identified by a uint32. The upper 16 bits are the connection id, | 13 // Nodes are identified by a uint32. The upper 16 bits are the connection id, |
14 // and the lower 16 the id assigned by the client. CreateNode() only takes a | 14 // and the lower 16 the id assigned by the client. CreateNode() only takes a |
15 // uint16 as the connection id of the originating connection is used. | 15 // uint16 as the connection id of the originating connection is used. |
16 // | 16 // |
17 // The root node is identified with a connection id of 0, and value of 1. | 17 // The root node is identified with a connection id of 0, and value of 1. |
18 [Peer=ViewManagerClient] | 18 [Peer=ViewManagerClient] |
19 interface ViewManager { | 19 interface ViewManager { |
20 // Creates a new node with the specified id. It is up to the client to ensure | 20 // Creates a new node with the specified id. It is up to the client to ensure |
21 // the id is unique to the connection (the id need not be globally unique). | 21 // the id is unique to the connection (the id need not be globally unique). |
22 CreateNode(uint16 node_id) => (bool success); | 22 CreateNode(uint16 node_id) => (bool success); |
23 | 23 |
| 24 // Deletes a node. This does not recurse. Children are removed from the node |
| 25 // before it is destroyed. |
| 26 DeleteNode(uint32 node_id, int32 change_id) => (bool success); |
| 27 |
24 // Reparents a node. See description above class for details of |change_id|. | 28 // Reparents a node. See description above class for details of |change_id|. |
25 AddNode(uint32 parent, uint32 child, int32 change_id) => (bool success); | 29 AddNode(uint32 parent, uint32 child, int32 change_id) => (bool success); |
26 | 30 |
27 // Removes a view from its current parent. See description above class for | 31 // Removes a view from its current parent. See description above class for |
28 // details of |change_id|. | 32 // details of |change_id|. |
29 RemoveNodeFromParent(uint32 node_id, int32 change_id) => (bool success); | 33 RemoveNodeFromParent(uint32 node_id, int32 change_id) => (bool success); |
30 | 34 |
31 // Creates a new view with the specified id. It is up to the client to ensure | 35 // Creates a new view with the specified id. It is up to the client to ensure |
32 // the id is unique to the connection (the id need not be globally unique). | 36 // the id is unique to the connection (the id need not be globally unique). |
33 // CreateView(uint16 view_id) => (bool success); | 37 CreateView(uint16 view_id) => (bool success); |
| 38 |
| 39 // Deletes the view with the specified id. |
| 40 DeleteView(uint32 view_id, int32 change_id) => (bool success); |
34 | 41 |
35 // Sets the view a node is showing. | 42 // Sets the view a node is showing. |
36 // SetView(uint32 node, uint32 view) => (bool success); | 43 SetView(uint32 node_id, uint32 view_id, int32 change_id) => (bool success); |
37 }; | 44 }; |
38 | 45 |
39 [Peer=ViewManager] | 46 [Peer=ViewManager] |
40 interface ViewManagerClient { | 47 interface ViewManagerClient { |
41 // Invoked once the connection has been established. |connection_id| is the id | 48 // Invoked once the connection has been established. |connection_id| is the id |
42 // used to uniquely identify the connection. | 49 // used to uniquely identify the connection. |
43 OnConnectionEstablished(uint16 connection_id); | 50 OnConnectionEstablished(uint16 connection_id); |
44 | 51 |
45 // Invoked when a change is done to the hierarchy. A value of 0 is used to | 52 // Invoked when a change is done to the hierarchy. A value of 0 is used to |
46 // identify a null node. For example, if the old_parent is NULL, 0 is | 53 // identify a null node. For example, if the old_parent is NULL, 0 is |
47 // supplied. See description above ViewManager for details on |change_id|. | 54 // supplied. See description above ViewManager for details on |change_id|. |
48 OnNodeHierarchyChanged(uint32 node, | 55 OnNodeHierarchyChanged(uint32 node, |
49 uint32 new_parent, | 56 uint32 new_parent, |
50 uint32 old_parent, | 57 uint32 old_parent, |
51 int32 change_id); | 58 int32 change_id); |
| 59 |
| 60 // Invoked when the view associated with a node is replaced by another view. |
| 61 // 0 is used to identify a null view. |
| 62 OnNodeViewReplaced(uint32 node, |
| 63 uint32 new_view_id, |
| 64 uint32 old_view_id, |
| 65 int32 change_id); |
52 }; | 66 }; |
53 | 67 |
54 } | 68 } |
OLD | NEW |