| 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 "../geometry/geometry.mojom" | 5 import "../geometry/geometry.mojom" |
| 6 import "../input_events/input_events.mojom" | 6 import "../input_events/input_events.mojom" |
| 7 | 7 |
| 8 module mojo.view_manager { | 8 module mojo.view_manager { |
| 9 | 9 |
| 10 struct INode { | 10 struct INode { |
| 11 uint32 parent_id; | 11 uint32 parent_id; |
| 12 uint32 node_id; | 12 uint32 node_id; |
| 13 uint32 view_id; | 13 uint32 view_id; |
| 14 mojo.Rect bounds; | 14 mojo.Rect bounds; |
| 15 }; | 15 }; |
| 16 | 16 |
| 17 // IViewManagerInit is responsible for launching the client that controls the | 17 // IViewManagerInit is responsible for launching the client that controls the |
| 18 // root node. mojo::view_manager returns an instance of this. All other | 18 // root node. mojo::view_manager returns an instance of this. All other |
| 19 // connections are established by the client this creates. | 19 // connections are established by the client this creates. |
| 20 interface IViewManagerInit { | 20 interface IViewManagerInit { |
| 21 // Connects to |url| creating a connection that has the roots |nodes|. | 21 EmbedRoot(string url) => (bool success); |
| 22 Connect(string url) => (bool success); | |
| 23 }; | 22 }; |
| 24 | 23 |
| 25 // Functions that mutate the hierarchy take a change id. This is an ever | 24 // Functions that mutate the hierarchy take a change id. This is an ever |
| 26 // increasing integer used to identify the change. Every hierarchy change | 25 // increasing integer used to identify the change. Every hierarchy change |
| 27 // increases this value. The server only accepts changes where the supplied | 26 // increases this value. The server only accepts changes where the supplied |
| 28 // |server_change_id| matches the expected next value. This ensures changes are | 27 // |server_change_id| matches the expected next value. This ensures changes are |
| 29 // made in a well defined order. | 28 // made in a well defined order. |
| 30 // | 29 // |
| 31 // Nodes and Views are identified by a uint32. The upper 16 bits are the | 30 // Nodes and Views are identified by a uint32. The upper 16 bits are the |
| 32 // connection id, and the lower 16 the id assigned by the client. | 31 // connection id, and the lower 16 the id assigned by the client. |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 DeleteView(uint32 view_id) => (bool success); | 89 DeleteView(uint32 view_id) => (bool success); |
| 91 | 90 |
| 92 // Sets the view a node is showing. | 91 // Sets the view a node is showing. |
| 93 SetView(uint32 node_id, uint32 view_id) => (bool success); | 92 SetView(uint32 node_id, uint32 view_id) => (bool success); |
| 94 | 93 |
| 95 // Shows the specified image (png encoded) in the specified view. | 94 // Shows the specified image (png encoded) in the specified view. |
| 96 SetViewContents(uint32 view_id, | 95 SetViewContents(uint32 view_id, |
| 97 handle<shared_buffer> buffer, | 96 handle<shared_buffer> buffer, |
| 98 uint32 buffer_size) => (bool success); | 97 uint32 buffer_size) => (bool success); |
| 99 | 98 |
| 100 // Connects to |url| creating a connection that has the roots |nodes|. Fails | 99 // Embeds the app at |url| in the specified nodes. More specifically this |
| 100 // creates a new connection to the specified url, expecting to get an |
| 101 // IViewManagerClient and configures it with the root nodes |nodes|. Fails |
| 101 // if |nodes| is empty or contains nodes that were not created by this | 102 // if |nodes| is empty or contains nodes that were not created by this |
| 102 // connection. | 103 // connection. |
| 103 // If a particular client invokes Connect() multiple times with the same url, | 104 // If a particular client invokes Embed() multiple times with the same url, |
| 104 // the connection is reused. When this happens the IViewManagerClient is | 105 // the connection is reused. When this happens the IViewManagerClient is |
| 105 // notified of the additional roots by way of OnRootsAdded(). | 106 // notified of the additional roots by way of OnRootsAdded(). |
| 106 Connect(string url, uint32[] nodes) => (bool success); | 107 Embed(string url, uint32[] nodes) => (bool success); |
| 107 }; | 108 }; |
| 108 | 109 |
| 109 // Changes to nodes/views are not sent to the connection that originated the | 110 // Changes to nodes/views are not sent to the connection that originated the |
| 110 // change. For example, if connection 1 attaches a view to a node (SetView()) | 111 // change. For example, if connection 1 attaches a view to a node (SetView()) |
| 111 // connection 1 does not receive OnNodeViewReplaced(). | 112 // connection 1 does not receive OnNodeViewReplaced(). |
| 112 [Client=IViewManager] | 113 [Client=IViewManager] |
| 113 interface IViewManagerClient { | 114 interface IViewManagerClient { |
| 114 // Invoked once the connection has been established. |connection_id| is the id | 115 // Invoked once the connection has been established. |connection_id| is the id |
| 115 // that uniquely identifies this connection. |next_server_change_id| is the | 116 // that uniquely identifies this connection. |next_server_change_id| is the |
| 116 // id of the next change the server is expecting. |nodes| are the nodes | 117 // id of the next change the server is expecting. |nodes| are the nodes |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 OnNodeViewReplaced(uint32 node, uint32 new_view_id, uint32 old_view_id); | 155 OnNodeViewReplaced(uint32 node, uint32 new_view_id, uint32 old_view_id); |
| 155 | 156 |
| 156 // Invoked when a view is deleted. | 157 // Invoked when a view is deleted. |
| 157 OnViewDeleted(uint32 view); | 158 OnViewDeleted(uint32 view); |
| 158 | 159 |
| 159 // Invoked when an event is targeted at the specified view. | 160 // Invoked when an event is targeted at the specified view. |
| 160 OnViewInputEvent(uint32 view, mojo.Event event) => (); | 161 OnViewInputEvent(uint32 view, mojo.Event event) => (); |
| 161 }; | 162 }; |
| 162 | 163 |
| 163 } | 164 } |
| OLD | NEW |