| 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/public/interfaces/application/service_provider.mojom" |
| 5 import "mojo/services/public/interfaces/geometry/geometry.mojom" | 6 import "mojo/services/public/interfaces/geometry/geometry.mojom" |
| 6 import "mojo/services/public/interfaces/input_events/input_events.mojom" | 7 import "mojo/services/public/interfaces/input_events/input_events.mojom" |
| 7 import "mojo/services/public/interfaces/view_manager/view_manager_constants.mojo
m" | 8 import "mojo/services/public/interfaces/view_manager/view_manager_constants.mojo
m" |
| 8 | 9 |
| 9 module mojo { | 10 module mojo { |
| 10 | 11 |
| 11 struct NodeData { | 12 struct NodeData { |
| 12 uint32 parent_id; | 13 uint32 parent_id; |
| 13 uint32 node_id; | 14 uint32 node_id; |
| 14 uint32 view_id; | 15 uint32 view_id; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 26 // ViewManager by embedding it at an approriate Node. | 27 // ViewManager by embedding it at an approriate Node. |
| 27 interface ViewManagerInitService { | 28 interface ViewManagerInitService { |
| 28 // Embed the application @ |url| at an appropriate Node. | 29 // Embed the application @ |url| at an appropriate Node. |
| 29 // The first time this method is called in the lifetime of a View Manager | 30 // The first time this method is called in the lifetime of a View Manager |
| 30 // application instance, the "appropriate Node" is defined as being the | 31 // application instance, the "appropriate Node" is defined as being the |
| 31 // service root Node. | 32 // service root Node. |
| 32 // Subsequent times, implementation of this method is delegated to the | 33 // Subsequent times, implementation of this method is delegated to the |
| 33 // application embedded at the service root Node. This application is | 34 // application embedded at the service root Node. This application is |
| 34 // typically referred to as the "window manager", and will have a specific | 35 // typically referred to as the "window manager", and will have a specific |
| 35 // definition of where within its Node hierarchy to embed an unparented URL. | 36 // definition of where within its Node hierarchy to embed an unparented URL. |
| 36 Embed(string url) => (bool success); | 37 // See ViewManagerService below for more details about |service_provider|. |
| 38 Embed(string url, ServiceProvider service_provider) => (bool success); |
| 37 }; | 39 }; |
| 38 | 40 |
| 39 // Nodes and Views are identified by a uint32. The upper 16 bits are the | 41 // Nodes and Views are identified by a uint32. The upper 16 bits are the |
| 40 // connection id, and the lower 16 the id assigned by the client. | 42 // connection id, and the lower 16 the id assigned by the client. |
| 41 // | 43 // |
| 42 // The root node is identified with a connection id of 0, and value of 1. | 44 // The root node is identified with a connection id of 0, and value of 1. |
| 43 [Client=ViewManagerClient] | 45 [Client=ViewManagerClient] |
| 44 interface ViewManagerService { | 46 interface ViewManagerService { |
| 45 // Creates a new node with the specified id. It is up to the client to ensure | 47 // Creates a new node with the specified id. It is up to the client to ensure |
| 46 // 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). |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 // OnNodeDeleted(). | 137 // OnNodeDeleted(). |
| 136 // | 138 // |
| 137 // When a connection embeds an app the connection no longer has priviledges | 139 // 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 | 140 // 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 | 141 // children the children are removed. The one exception is the root |
| 140 // connection. | 142 // connection. |
| 141 // | 143 // |
| 142 // If |node_id| is 0, the View Manager delegates determination of what node to | 144 // If |node_id| is 0, the View Manager delegates determination of what node to |
| 143 // embed |url| at to the app embedded at the service root node (i.e. the | 145 // embed |url| at to the app embedded at the service root node (i.e. the |
| 144 // window manager). | 146 // window manager). |
| 145 Embed(string url, uint32 node_id) => (bool success); | 147 // |
| 148 // |service_provider| encapsulates services offered by the embedder to the |
| 149 // embedded app alongside this Embed() call. It also provides a means for |
| 150 // the embedder to connect to services symmetrically exposed by the embedded |
| 151 // app. Note that if a different app is subsequently embedded at |node_id| |
| 152 // the |service_provider|'s connection to its client in the embedded app and |
| 153 // any services it provided are not broken and continue to be valid. |
| 154 Embed(string url, |
| 155 uint32 node_id, |
| 156 ServiceProvider service_provider) => (bool success); |
| 146 | 157 |
| 147 // TODO(sky): move these to a separate interface when FIFO works. | 158 // TODO(sky): move these to a separate interface when FIFO works. |
| 148 | 159 |
| 149 // Sends OnViewInputEvent() to the owner of the specified view. | 160 // Sends OnViewInputEvent() to the owner of the specified view. |
| 150 DispatchOnViewInputEvent(uint32 view_id, mojo.Event event); | 161 DispatchOnViewInputEvent(uint32 view_id, mojo.Event event); |
| 151 }; | 162 }; |
| 152 | 163 |
| 153 // Changes to nodes/views are not sent to the connection that originated the | 164 // Changes to nodes/views are not sent to the connection that originated the |
| 154 // change. For example, if connection 1 attaches a view to a node (SetView()) | 165 // change. For example, if connection 1 attaches a view to a node (SetView()) |
| 155 // connection 1 does not receive OnNodeViewReplaced(). | 166 // connection 1 does not receive OnNodeViewReplaced(). |
| 156 [Client=ViewManagerService] | 167 [Client=ViewManagerService] |
| 157 interface ViewManagerClient { | 168 interface ViewManagerClient { |
| 158 // Invoked when the client application has been embedded at |root|. | 169 // Invoked when the client application has been embedded at |root|. |
| 159 OnEmbed(uint16 connection_id, string embedder_url, NodeData root); | 170 // See Embed() on ViewManagerService for more details. |
| 171 OnEmbed(uint16 connection_id, |
| 172 string embedder_url, |
| 173 NodeData root, |
| 174 ServiceProvider& service_provider); |
| 160 | 175 |
| 161 // Invoked when a node's bounds have changed. | 176 // Invoked when a node's bounds have changed. |
| 162 OnNodeBoundsChanged(uint32 node, mojo.Rect old_bounds, mojo.Rect new_bounds); | 177 OnNodeBoundsChanged(uint32 node, mojo.Rect old_bounds, mojo.Rect new_bounds); |
| 163 | 178 |
| 164 // Invoked when a change is done to the hierarchy. A value of 0 is used to | 179 // Invoked when a change is done to the hierarchy. A value of 0 is used to |
| 165 // identify a null node. For example, if the old_parent is NULL, 0 is | 180 // identify a null node. For example, if the old_parent is NULL, 0 is |
| 166 // supplied. | 181 // supplied. |
| 167 // |nodes| contains any nodes that are that the client has not been told | 182 // |nodes| contains any nodes that are that the client has not been told |
| 168 // about. This is not sent for hierarchy changes of nodes not known to this | 183 // about. This is not sent for hierarchy changes of nodes not known to this |
| 169 // client or not attached to the tree. | 184 // client or not attached to the tree. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 199 // removed. | 214 // removed. |
| 200 OnFocusChanged(uint32 gained_focus_id, uint32 lost_focus_id); | 215 OnFocusChanged(uint32 gained_focus_id, uint32 lost_focus_id); |
| 201 | 216 |
| 202 // TODO(sky): The following methods represent an interface between the view | 217 // TODO(sky): The following methods represent an interface between the view |
| 203 // manager and the application embedded at the service root node | 218 // manager and the application embedded at the service root node |
| 204 // (i.e. the window manager). These methods are not called on | 219 // (i.e. the window manager). These methods are not called on |
| 205 // any other clients. They should be moved to a separate interface | 220 // any other clients. They should be moved to a separate interface |
| 206 // once support for derived FIFOs is landed. | 221 // once support for derived FIFOs is landed. |
| 207 | 222 |
| 208 // Requests the window manager create a "top level" node embedding |url|. | 223 // Requests the window manager create a "top level" node embedding |url|. |
| 209 Embed(string url); | 224 Embed(string url, ServiceProvider& service_provider); |
| 210 | 225 |
| 211 // Requests the view manager dispatch the event targeted at |view|. | 226 // Requests the view manager dispatch the event targeted at |view|. |
| 212 DispatchOnViewInputEvent(uint32 view, mojo.Event event); | 227 DispatchOnViewInputEvent(uint32 view, mojo.Event event); |
| 213 }; | 228 }; |
| 214 | 229 |
| 215 } | 230 } |
| OLD | NEW |