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