| 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 |
| 11 struct NodeData { | 11 struct NodeData { |
| 12 uint32 parent_id; | 12 uint32 parent_id; |
| 13 uint32 node_id; | 13 uint32 node_id; |
| 14 uint32 view_id; | 14 uint32 view_id; |
| 15 mojo.Rect bounds; | 15 mojo.Rect bounds; |
| 16 // TODO(sky): add visible. | 16 // TODO(sky): add visible. |
| 17 }; | 17 }; |
| 18 | 18 |
| 19 enum ErrorCode { |
| 20 ERROR_CODE_NONE, |
| 21 ERROR_CODE_VALUE_IN_USE, |
| 22 ERROR_CODE_ILLEGAL_ARGUMENT, |
| 23 ERROR_CODE_UNEXPECTED_CHANGE_ID, |
| 24 }; |
| 25 |
| 19 // ViewManagerInitService is responsible for launching the client that controls | 26 // ViewManagerInitService is responsible for launching the client that controls |
| 20 // the root node. mojo::view_manager returns an instance of this. All other | 27 // the root node. mojo::view_manager returns an instance of this. All other |
| 21 // connections are established by the client this creates. | 28 // connections are established by the client this creates. |
| 22 interface ViewManagerInitService { | 29 interface ViewManagerInitService { |
| 23 EmbedRoot(string url) => (bool success); | 30 EmbedRoot(string url) => (bool success); |
| 24 }; | 31 }; |
| 25 | 32 |
| 26 // Functions that mutate the hierarchy take a change id. This is an ever | 33 // Functions that mutate the hierarchy take a change id. This is an ever |
| 27 // increasing integer used to identify the change. Every hierarchy change | 34 // increasing integer used to identify the change. Every hierarchy change |
| 28 // increases this value. The server only accepts changes where the supplied | 35 // increases this value. The server only accepts changes where the supplied |
| 29 // |server_change_id| matches the expected next value. This ensures changes are | 36 // |server_change_id| matches the expected next value. This ensures changes are |
| 30 // made in a well defined order. | 37 // made in a well defined order. |
| 31 // | 38 // |
| 32 // Nodes and Views are identified by a uint32. The upper 16 bits are the | 39 // Nodes and Views are identified by a uint32. The upper 16 bits are the |
| 33 // connection id, and the lower 16 the id assigned by the client. | 40 // connection id, and the lower 16 the id assigned by the client. |
| 34 // | 41 // |
| 35 // The root node is identified with a connection id of 0, and value of 1. | 42 // The root node is identified with a connection id of 0, and value of 1. |
| 36 [Client=ViewManagerClient] | 43 [Client=ViewManagerClient] |
| 37 interface ViewManagerService { | 44 interface ViewManagerService { |
| 38 // Creates a new node with the specified id. It is up to the client to ensure | 45 // Creates a new node with the specified id. It is up to the client to ensure |
| 39 // the id is unique to the connection (the id need not be globally unique). | 46 // the id is unique to the connection (the id need not be globally unique). |
| 40 // Additionally the connection id (embedded in |node_id|) must match that of | 47 // Additionally the connection id (embedded in |node_id|) must match that of |
| 41 // the connection. | 48 // the connection. |
| 42 CreateNode(uint32 node_id) => (bool success); | 49 // Errors: |
| 50 // ERROR_CODE_VALUE_IN_USE: a node already exists with the specified id. |
| 51 // ERROR_CODE_ILLEGAL_ARGUMENT: The connection part of |node_id| does not |
| 52 // match the connection id of the client. |
| 53 CreateNode(uint32 node_id) => (ErrorCode error_code); |
| 43 | 54 |
| 44 // Deletes a node. This does not recurse. No hierarchy change notifications | 55 // Deletes a node. This does not recurse. No hierarchy change notifications |
| 45 // are sent as a result of this. Only the connection that created the node can | 56 // are sent as a result of this. Only the connection that created the node can |
| 46 // delete it. | 57 // delete it. |
| 47 DeleteNode(uint32 node_id, uint32 change_id) => (bool success); | 58 DeleteNode(uint32 node_id, uint32 change_id) => (bool success); |
| 48 | 59 |
| 49 // Sets the specified bounds of the specified node. | 60 // Sets the specified bounds of the specified node. |
| 50 SetNodeBounds(uint32 node_id, mojo.Rect bounds) => (bool success); | 61 SetNodeBounds(uint32 node_id, mojo.Rect bounds) => (bool success); |
| 51 | 62 |
| 52 // Sets the visibility of the specified node to |visible|. Connections are | 63 // Sets the visibility of the specified node to |visible|. Connections are |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 // entirely move to the window manager and this method can be | 210 // entirely move to the window manager and this method can be |
| 200 // removed. | 211 // removed. |
| 201 OnFocusChanged(uint32 gained_focus_id, uint32 lost_focus_id); | 212 OnFocusChanged(uint32 gained_focus_id, uint32 lost_focus_id); |
| 202 | 213 |
| 203 // TODO(sky): move to separate interface when FIFO sorted out. | 214 // TODO(sky): move to separate interface when FIFO sorted out. |
| 204 | 215 |
| 205 DispatchOnViewInputEvent(uint32 view, mojo.Event event); | 216 DispatchOnViewInputEvent(uint32 view, mojo.Event event); |
| 206 }; | 217 }; |
| 207 | 218 |
| 208 } | 219 } |
| OLD | NEW |