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