| 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=IViewManagerClient] | 24 [Client=IViewManagerClient] |
| 25 interface IViewManager { | 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|. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 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 // Shows the specified image (png encoded) in the specified view. | 57 // Shows the specified image (png encoded) in the specified view. |
| 58 SetViewContents(uint32 view_id, | 58 SetViewContents(uint32 view_id, |
| 59 handle<shared_buffer> buffer, | 59 handle<shared_buffer> buffer, |
| 60 uint32 buffer_size); | 60 uint32 buffer_size); |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 [Peer=IViewManager] | |
| 64 interface IViewManagerClient { | 63 interface IViewManagerClient { |
| 65 // Invoked once the connection has been established. |connection_id| is the id | 64 // Invoked once the connection has been established. |connection_id| is the id |
| 66 // used to uniquely identify the connection. | 65 // used to uniquely identify the connection. |
| 67 OnConnectionEstablished(uint16 connection_id); | 66 OnConnectionEstablished(uint16 connection_id); |
| 68 | 67 |
| 69 // Invoked when a change is done to the hierarchy. A value of 0 is used to | 68 // Invoked when a change is done to the hierarchy. A value of 0 is used to |
| 70 // identify a null node. For example, if the old_parent is NULL, 0 is | 69 // identify a null node. For example, if the old_parent is NULL, 0 is |
| 71 // supplied. See description above ViewManager for details on |change_id|. | 70 // supplied. See description above ViewManager for details on |change_id|. |
| 72 OnNodeHierarchyChanged(uint32 node, | 71 OnNodeHierarchyChanged(uint32 node, |
| 73 uint32 new_parent, | 72 uint32 new_parent, |
| 74 uint32 old_parent, | 73 uint32 old_parent, |
| 75 uint32 change_id); | 74 uint32 change_id); |
| 76 | 75 |
| 77 // Invoked when the view associated with a node is replaced by another view. | 76 // Invoked when the view associated with a node is replaced by another view. |
| 78 // 0 is used to identify a null view. | 77 // 0 is used to identify a null view. |
| 79 OnNodeViewReplaced(uint32 node, | 78 OnNodeViewReplaced(uint32 node, |
| 80 uint32 new_view_id, | 79 uint32 new_view_id, |
| 81 uint32 old_view_id, | 80 uint32 old_view_id, |
| 82 uint32 change_id); | 81 uint32 change_id); |
| 83 | 82 |
| 84 // Invoked when a node is deleted. | 83 // Invoked when a node is deleted. |
| 85 OnNodeDeleted(uint32 node, uint32 change_id); | 84 OnNodeDeleted(uint32 node, uint32 change_id); |
| 86 }; | 85 }; |
| 87 | 86 |
| 88 } | 87 } |
| OLD | NEW |