| 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 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 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 // This fails for any of the following reasons: | 69 // This fails for any of the following reasons: |
| 70 // . |parent| or |child| does not identify a valid node. | 70 // . |parent| or |child| does not identify a valid node. |
| 71 // . |child| is an ancestor of |parent|. | 71 // . |child| is an ancestor of |parent|. |
| 72 // . |child| is already a child of |parent|. | 72 // . |child| is already a child of |parent|. |
| 73 // | 73 // |
| 74 // This may result in a connection getting OnNodeDeleted(). See | 74 // This may result in a connection getting OnNodeDeleted(). See |
| 75 // RemoveNodeFromParent for details. | 75 // RemoveNodeFromParent for details. |
| 76 AddNode(uint32 parent, uint32 child) => (bool success); | 76 AddNode(uint32 parent, uint32 child) => (bool success); |
| 77 | 77 |
| 78 // Removes a view from its current parent. This fails if the node is not | 78 // Removes a view from its current parent. This fails if the node is not |
| 79 // valid, |server_change_id| doesn't match, or the node already has no parent. | 79 // valid or the node already has no parent. |
| 80 // | 80 // |
| 81 // Removing a node from a parent may result in OnNodeDeleted() being sent to | 81 // Removing a node from a parent may result in OnNodeDeleted() being sent to |
| 82 // other connections. For example, connection A has nodes 1 and 2, with 2 a | 82 // other connections. For example, connection A has nodes 1 and 2, with 2 a |
| 83 // child of 1. Connection B has a root 1. If 2 is removed from 1 then B gets | 83 // child of 1. Connection B has a root 1. If 2 is removed from 1 then B gets |
| 84 // OnNodeDeleted(). This is done as node 2 is effectively no longer visible to | 84 // OnNodeDeleted(). This is done as node 2 is effectively no longer visible to |
| 85 // connection B. | 85 // connection B. |
| 86 RemoveNodeFromParent(uint32 node_id) => (bool success); | 86 RemoveNodeFromParent(uint32 node_id) => (bool success); |
| 87 | 87 |
| 88 // Reorders a node in its parent, relative to |relative_node_id| according to | 88 // Reorders a node in its parent, relative to |relative_node_id| according to |
| 89 // |direction|. | 89 // |direction|. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 // | 127 // |
| 128 // If a particular client invokes Embed() multiple times with the same url, | 128 // If a particular client invokes Embed() multiple times with the same url, |
| 129 // the connection is reused. When this happens the ViewManagerClient is | 129 // the connection is reused. When this happens the ViewManagerClient is |
| 130 // notified of the additional roots by way of OnRootAdded(). | 130 // notified of the additional roots by way of OnRootAdded(). |
| 131 // | 131 // |
| 132 // A node may only be a root of one connection at a time. Subsequent calls to | 132 // A node may only be a root of one connection at a time. Subsequent calls to |
| 133 // Embed() for the same node result in the node being removed from the | 133 // Embed() for the same node result in the node being removed from the |
| 134 // current connection. The current connection is told this by way of | 134 // current connection. The current connection is told this by way of |
| 135 // OnNodeDeleted(). | 135 // OnNodeDeleted(). |
| 136 // | 136 // |
| 137 // When a connection embeds an app the connection no longer has priviledges |
| 138 // to access or see any of the children of the node. If the node had existing |
| 139 // children the children are removed. The one exception is the root |
| 140 // connection. |
| 141 // |
| 137 // If |node_id| is 0, the View Manager delegates determination of what node to | 142 // If |node_id| is 0, the View Manager delegates determination of what node to |
| 138 // embed |url| at to the app embedded at the service root node (i.e. the | 143 // embed |url| at to the app embedded at the service root node (i.e. the |
| 139 // window manager). | 144 // window manager). |
| 140 // | |
| 141 // This advances the server change id. | |
| 142 Embed(string url, uint32 node_id) => (bool success); | 145 Embed(string url, uint32 node_id) => (bool success); |
| 143 | 146 |
| 144 // TODO(sky): move these to a separate interface when FIFO works. | 147 // TODO(sky): move these to a separate interface when FIFO works. |
| 145 | 148 |
| 146 // Sends OnViewInputEvent() to the owner of the specified view. | 149 // Sends OnViewInputEvent() to the owner of the specified view. |
| 147 DispatchOnViewInputEvent(uint32 view_id, mojo.Event event); | 150 DispatchOnViewInputEvent(uint32 view_id, mojo.Event event); |
| 148 }; | 151 }; |
| 149 | 152 |
| 150 // Changes to nodes/views are not sent to the connection that originated the | 153 // Changes to nodes/views are not sent to the connection that originated the |
| 151 // change. For example, if connection 1 attaches a view to a node (SetView()) | 154 // change. For example, if connection 1 attaches a view to a node (SetView()) |
| 152 // connection 1 does not receive OnNodeViewReplaced(). | 155 // connection 1 does not receive OnNodeViewReplaced(). |
| 153 [Client=ViewManagerService] | 156 [Client=ViewManagerService] |
| 154 interface ViewManagerClient { | 157 interface ViewManagerClient { |
| 155 // Invoked once the connection has been established. |connection_id| is the id | 158 // Invoked once the connection has been established. |connection_id| is the id |
| 156 // that uniquely identifies this connection. |nodes| are the nodes parented to | 159 // that uniquely identifies this connection. |nodes| are the nodes parented to |
| 157 // the root. | 160 // the root. |
| 158 OnViewManagerConnectionEstablished(uint16 connection_id, | 161 OnViewManagerConnectionEstablished(uint16 connection_id, |
| 159 string creator_url, | 162 string creator_url, |
| 160 NodeData[] nodes); | 163 NodeData[] nodes); |
| 161 | 164 |
| 162 // See description of ViewManagerService::Embed() for details as to when | 165 // See description of ViewManagerService::Embed() for details as to when |
| 163 // this is invoked. | 166 // this is invoked. |
| 164 OnRootAdded(NodeData[] nodes); | 167 OnRootAdded(NodeData[] nodes); |
| 165 | 168 |
| 166 // Invoked when a node's bounds have changed. | 169 // Invoked when a node's bounds have changed. |
| 167 OnNodeBoundsChanged(uint32 node, mojo.Rect old_bounds, mojo.Rect new_bounds); | 170 OnNodeBoundsChanged(uint32 node, mojo.Rect old_bounds, mojo.Rect new_bounds); |
| 168 | 171 |
| 169 // Invoked when a change is done to the hierarchy. A value of 0 is used to | 172 // Invoked when a change is done to the hierarchy. A value of 0 is used to |
| 170 // identify a null node. For example, if the old_parent is NULL, 0 is | 173 // identify a null node. For example, if the old_parent is NULL, 0 is |
| 171 // supplied. See description above ViewManager for details on the change ids. | 174 // supplied. |
| 172 // |nodes| contains any nodes that are that the client has not been told | 175 // |nodes| contains any nodes that are that the client has not been told |
| 173 // about. This is not sent for hierarchy changes of nodes not known to this | 176 // about. This is not sent for hierarchy changes of nodes not known to this |
| 174 // client or not attached to the tree. | 177 // client or not attached to the tree. |
| 175 OnNodeHierarchyChanged(uint32 node, | 178 OnNodeHierarchyChanged(uint32 node, |
| 176 uint32 new_parent, | 179 uint32 new_parent, |
| 177 uint32 old_parent, | 180 uint32 old_parent, |
| 178 NodeData[] nodes); | 181 NodeData[] nodes); |
| 179 | 182 |
| 180 // Invoked when the order of nodes within a parent changes. | 183 // Invoked when the order of nodes within a parent changes. |
| 181 OnNodeReordered(uint32 node_id, | 184 OnNodeReordered(uint32 node_id, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 211 // once support for derived FIFOs is landed. | 214 // once support for derived FIFOs is landed. |
| 212 | 215 |
| 213 // Requests the window manager create a "top level" node embedding |url|. | 216 // Requests the window manager create a "top level" node embedding |url|. |
| 214 Embed(string url); | 217 Embed(string url); |
| 215 | 218 |
| 216 // Requests the view manager dispatch the event targeted at |view|. | 219 // Requests the view manager dispatch the event targeted at |view|. |
| 217 DispatchOnViewInputEvent(uint32 view, mojo.Event event); | 220 DispatchOnViewInputEvent(uint32 view, mojo.Event event); |
| 218 }; | 221 }; |
| 219 | 222 |
| 220 } | 223 } |
| OLD | NEW |