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.view_manager { | 5 module mojo.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; |
(...skipping 10 matching lines...) Expand all Loading... |
21 // | 21 // |
22 // The root node is identified with a connection id of 0, and value of 1. | 22 // The root node is identified with a connection id of 0, and value of 1. |
23 [Client=IViewManagerClient] | 23 [Client=IViewManagerClient] |
24 interface IViewManager { | 24 interface IViewManager { |
25 // Creates a new node with the specified id. It is up to the client to ensure | 25 // Creates a new node with the specified id. It is up to the client to ensure |
26 // the id is unique to the connection (the id need not be globally unique). | 26 // the id is unique to the connection (the id need not be globally unique). |
27 // Additionally the connection id (embedded in |node_id|) must match that of | 27 // Additionally the connection id (embedded in |node_id|) must match that of |
28 // the connection. | 28 // the connection. |
29 CreateNode(uint32 node_id) => (bool success); | 29 CreateNode(uint32 node_id) => (bool success); |
30 | 30 |
31 // Deletes a node. This does not recurse. Children are removed from the node | 31 // Deletes a node. This does not recurse. No hierarchy change notifications |
32 // before it is destroyed. Deletion is always allowed and implicitly advances | 32 // are sent as a result of this. Deletion is always allowed and implicitly |
33 // |server_change_id|. | 33 // advances |server_change_id|. |
34 DeleteNode(uint32 node_id) => (bool success); | 34 DeleteNode(uint32 node_id) => (bool success); |
35 | 35 |
36 // Reparents a node. See description above class for details of |change_id|. | 36 // Reparents a node. See description above class for details of |change_id|. |
37 // This fails for any of the following reasons: | 37 // This fails for any of the following reasons: |
38 // . |server_change_id| is not the expected id. | 38 // . |server_change_id| is not the expected id. |
39 // . |parent| or |child| does not identify a valid node. | 39 // . |parent| or |child| does not identify a valid node. |
40 // . |child| is an ancestor of |parent|. | 40 // . |child| is an ancestor of |parent|. |
41 // . |child| is already a child of |parent|. | 41 // . |child| is already a child of |parent|. |
42 AddNode(uint32 parent, | 42 AddNode(uint32 parent, |
43 uint32 child, | 43 uint32 child, |
(...skipping 28 matching lines...) Expand all Loading... |
72 handle<shared_buffer> buffer, | 72 handle<shared_buffer> buffer, |
73 uint32 buffer_size); | 73 uint32 buffer_size); |
74 }; | 74 }; |
75 | 75 |
76 // Changes to nodes/views are not sent to the connection that originated the | 76 // Changes to nodes/views are not sent to the connection that originated the |
77 // change. For example, if connection 1 attaches a view to a node (SetView()) | 77 // change. For example, if connection 1 attaches a view to a node (SetView()) |
78 // connection 1 does not receive OnNodeViewReplaced(). | 78 // connection 1 does not receive OnNodeViewReplaced(). |
79 interface IViewManagerClient { | 79 interface IViewManagerClient { |
80 // Invoked once the connection has been established. |connection_id| is the id | 80 // Invoked once the connection has been established. |connection_id| is the id |
81 // that uniquely identifies this connection. |next_server_change_id| is the | 81 // that uniquely identifies this connection. |next_server_change_id| is the |
82 // id of the next change the server is expecting. | 82 // id of the next change the server is expecting. |nodes| are the nodes |
83 OnConnectionEstablished(uint16 connection_id, uint32 next_server_change_id); | 83 // parented to the root. |
| 84 OnConnectionEstablished(uint16 connection_id, |
| 85 uint32 next_server_change_id, |
| 86 INode[] nodes); |
| 87 |
| 88 // This is sent to clients when a change is made to the server that results |
| 89 // in the |server_change_id| changing but the client isn't notified. This is |
| 90 // not sent if the client receives a callback giving a new |
| 91 // |server_change_id|. For example, if a client 1 changes the hierarchy in |
| 92 // some way but client 2 isn't notified of the change, then client 2 gets |
| 93 // OnServerChangeIdAdvanced(). |
| 94 OnServerChangeIdAdvanced(uint32 next_server_change_id); |
84 | 95 |
85 // Invoked when a change is done to the hierarchy. A value of 0 is used to | 96 // Invoked when a change is done to the hierarchy. A value of 0 is used to |
86 // identify a null node. For example, if the old_parent is NULL, 0 is | 97 // identify a null node. For example, if the old_parent is NULL, 0 is |
87 // supplied. See description above ViewManager for details on the change ids. | 98 // supplied. See description above ViewManager for details on the change ids. |
| 99 // |nodes| contains any nodes that are that the client has not been told |
| 100 // about. This is not sent for hierarchy changes of nodes not known to this |
| 101 // client or not attached to the tree. |
88 OnNodeHierarchyChanged(uint32 node, | 102 OnNodeHierarchyChanged(uint32 node, |
89 uint32 new_parent, | 103 uint32 new_parent, |
90 uint32 old_parent, | 104 uint32 old_parent, |
91 uint32 server_change_id); | 105 uint32 server_change_id, |
| 106 INode[] nodes); |
92 | 107 |
93 // Invoked when a node is deleted. | 108 // Invoked when a node is deleted. |
94 OnNodeDeleted(uint32 node, uint32 server_change_id); | 109 OnNodeDeleted(uint32 node, uint32 server_change_id); |
95 | |
96 | 110 |
97 // Invoked when the view associated with a node is replaced by another view. | 111 // Invoked when the view associated with a node is replaced by another view. |
98 // 0 is used to identify a null view. | 112 // 0 is used to identify a null view. |
99 OnNodeViewReplaced(uint32 node, uint32 new_view_id, uint32 old_view_id); | 113 OnNodeViewReplaced(uint32 node, uint32 new_view_id, uint32 old_view_id); |
100 | 114 |
101 // Invoked when a view is deleted. | 115 // Invoked when a view is deleted. |
102 OnViewDeleted(uint32 view); | 116 OnViewDeleted(uint32 view); |
103 }; | 117 }; |
104 | 118 |
105 } | 119 } |
OLD | NEW |