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 module mojo; | 5 module mojo; |
| 6 | 6 |
| 7 import "components/view_manager/public/interfaces/compositor_frame.mojom"; | 7 import "components/view_manager/public/interfaces/compositor_frame.mojom"; |
| 8 import "components/view_manager/public/interfaces/surface_id.mojom"; | 8 import "components/view_manager/public/interfaces/surface_id.mojom"; |
| 9 import "components/view_manager/public/interfaces/view_manager_constants.mojom"; | 9 import "components/view_manager/public/interfaces/view_manager_constants.mojom"; |
| 10 import "mojo/application/public/interfaces/service_provider.mojom"; | 10 import "mojo/application/public/interfaces/service_provider.mojom"; |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 37 NONE, | 37 NONE, |
| 38 VALUE_IN_USE, | 38 VALUE_IN_USE, |
| 39 ILLEGAL_ARGUMENT, | 39 ILLEGAL_ARGUMENT, |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 // Views are identified by a uint32. The upper 16 bits are the connection id, | 42 // Views are identified by a uint32. The upper 16 bits are the connection id, |
| 43 // and the lower 16 the id assigned by the client. | 43 // and the lower 16 the id assigned by the client. |
| 44 // | 44 // |
| 45 // The root view is identified with a connection id of 0, and value of 1. | 45 // The root view is identified with a connection id of 0, and value of 1. |
| 46 interface ViewTree { | 46 interface ViewTree { |
| 47 const uint32 kAccessPolicyDefault = 0; | |
|
Fady Samuel
2015/09/04 16:02:32
Could this be an enum instead?
sky
2015/09/04 16:38:11
As SetAccessPolicy is a bitmask it's a bit mislead
sky
2015/09/04 16:41:44
Actually, it looks like we still support explicit
| |
| 48 // An embed root has the following abilities: | |
| 49 // . The app sees all the descendants of the view the app is ebmedded at, even | |
| 50 // those from separate connections. | |
| 51 // . The app is able to Embed() in all the descendants of the view the app is | |
| 52 // embedded at, even those from separate connections. | |
| 53 // Only connections originating from the ViewTreeHostFactory can grant this | |
| 54 // policy. | |
| 55 const uint32 kAccessPolicyEmbedRoot = 1; | |
| 56 | |
| 47 // Creates a new view with the specified id. It is up to the client to ensure | 57 // Creates a new view with the specified id. It is up to the client to ensure |
| 48 // the id is unique to the connection (the id need not be globally unique). | 58 // the id is unique to the connection (the id need not be globally unique). |
| 49 // Additionally the connection id (embedded in |view_id|) must match that of | 59 // Additionally the connection id (embedded in |view_id|) must match that of |
| 50 // the connection. | 60 // the connection. |
| 51 // Errors: | 61 // Errors: |
| 52 // ERROR_CODE_VALUE_IN_USE: a view already exists with the specified id. | 62 // ERROR_CODE_VALUE_IN_USE: a view already exists with the specified id. |
| 53 // ERROR_CODE_ILLEGAL_ARGUMENT: The connection part of |view_id| does not | 63 // ERROR_CODE_ILLEGAL_ARGUMENT: The connection part of |view_id| does not |
| 54 // match the connection id of the client. | 64 // match the connection id of the client. |
| 55 // | 65 // |
| 56 // TODO(erg): Once we have default values in mojo, make this take a map of | 66 // TODO(erg): Once we have default values in mojo, make this take a map of |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 ReorderView(uint32 view_id, | 116 ReorderView(uint32 view_id, |
| 107 uint32 relative_view_id, | 117 uint32 relative_view_id, |
| 108 OrderDirection direction) => (bool success); | 118 OrderDirection direction) => (bool success); |
| 109 | 119 |
| 110 // Returns the views comprising the tree starting at |view_id|. |view_id| is | 120 // Returns the views comprising the tree starting at |view_id|. |view_id| is |
| 111 // the first result in the return value, unless |view_id| is invalid, in which | 121 // the first result in the return value, unless |view_id| is invalid, in which |
| 112 // case an empty vector is returned. The views are visited using a depth first | 122 // case an empty vector is returned. The views are visited using a depth first |
| 113 // search (pre-order). | 123 // search (pre-order). |
| 114 GetViewTree(uint32 view_id) => (array<ViewData> views); | 124 GetViewTree(uint32 view_id) => (array<ViewData> views); |
| 115 | 125 |
| 116 // TODO(sky): rename this and clarify what it does. | |
| 117 SetEmbedRoot(); | |
| 118 | |
| 119 // A connection may grant access to a view from another connection by way of | 126 // A connection may grant access to a view from another connection by way of |
| 120 // Embed(). Embed() results in a new ViewTreeClient configured with a root of | 127 // Embed(). Embed() results in a new ViewTreeClient configured with a root of |
| 121 // |view_id|. | 128 // |view_id|. |
| 122 // | 129 // |
| 123 // The caller must have created |view_id|. If not the request fails and the | 130 // The caller must have created |view_id|. If not the request fails and the |
| 124 // response is false. | 131 // response is false. |
| 125 // | 132 // |
| 126 // A view may only have one embedding in it at a time. Subsequent calls to | 133 // A view may only have one embedding in it at a time. Subsequent calls to |
| 127 // Embed() for the same view result in the currently embedded | 134 // Embed() for the same view result in the currently embedded |
| 128 // ViewTreeClient being removed. The embedded app is told this by way of | 135 // ViewTreeClient being removed. The embedded app is told this by way of |
| 129 // OnUnembed(), which is followed by OnViewDeleted() (as the connection no | 136 // OnUnembed(), which is followed by OnViewDeleted() (as the connection no |
| 130 // longer has access to the view). | 137 // longer has access to the view). |
| 131 // | 138 // |
| 132 // The embedder can detect when the embedded app disconnects by way of | 139 // The embedder can detect when the embedded app disconnects by way of |
| 133 // OnEmbeddedAppDisconnected(). | 140 // OnEmbeddedAppDisconnected(). |
| 134 // | 141 // |
| 135 // When a connection embeds an app the connection no longer has privileges | 142 // When a connection embeds an app the connection no longer has privileges |
| 136 // to access or see any of the children of the view. If the view had existing | 143 // to access or see any of the children of the view. If the view had existing |
| 137 // children the children are removed. The one exception is the root | 144 // children the children are removed. The one exception is the root |
| 138 // connection and any embed roots. The root always see the full tree, and | 145 // connection and any connections with the policy kAccessPolicyEmbedRoot. |
| 139 // embed roots see the complete tree at their embed point. | |
| 140 Embed(uint32 view_id, ViewTreeClient client) => (bool success); | 146 Embed(uint32 view_id, ViewTreeClient client) => (bool success); |
| 141 | 147 |
| 142 SetFocus(uint32 view_id); | 148 SetFocus(uint32 view_id); |
| 143 | 149 |
| 144 // Set text input state for the given view. | 150 // Set text input state for the given view. |
| 145 SetViewTextInputState(uint32 view_id, TextInputState state); | 151 SetViewTextInputState(uint32 view_id, TextInputState state); |
| 146 | 152 |
| 147 // Set the input method editor UI (software keyboard, etc) visibility. | 153 // Set the input method editor UI (software keyboard, etc) visibility. |
| 148 // If state is non-null, the specified view's text input state is updated. | 154 // If state is non-null, the specified view's text input state is updated. |
| 149 // Otherwise the existing state is used. | 155 // Otherwise the existing state is used. |
| 150 SetImeVisibility(uint32 view_id, bool visible, TextInputState? state); | 156 SetImeVisibility(uint32 view_id, bool visible, TextInputState? state); |
| 157 | |
| 158 // Sets the access policy for the next ViewTreeClient embedded in |view_id|. | |
| 159 // | |
| 160 // Not all connections are allowed to change the access policy. See each | |
| 161 // constant for specifics. | |
| 162 // | |
| 163 // policy_bitmask is a bitmask of the kAccessPolicy constants. See them for | |
| 164 // details. | |
| 165 SetAccessPolicy(uint32 view_id, uint32 policy_bitmask); | |
| 151 }; | 166 }; |
| 152 | 167 |
| 153 // Changes to views are not sent to the connection that originated the | 168 // Changes to views are not sent to the connection that originated the |
| 154 // change. For example, if connection 1 changes the bounds of a view by calling | 169 // change. For example, if connection 1 changes the bounds of a view by calling |
| 155 // SetBounds(), connection 1 does not receive OnViewBoundsChanged(). | 170 // SetBounds(), connection 1 does not receive OnViewBoundsChanged(). |
| 156 interface ViewTreeClient { | 171 interface ViewTreeClient { |
| 157 // Invoked when the client application has been embedded at |root|. | 172 // Invoked when the client application has been embedded at |root|. |
| 158 // See Embed() on ViewTree for more details. |tree| will be a handle back to | 173 // See Embed() on ViewTree for more details. |tree| will be a handle back to |
| 159 // the view manager service, unless the connection is to the root connection | 174 // the view manager service, unless the connection is to the root connection |
| 160 // in which case it will be null. | 175 // in which case it will be null. |
| 161 OnEmbed(uint16 connection_id, | 176 OnEmbed(uint16 connection_id, |
| 162 ViewData root, | 177 ViewData root, |
| 163 ViewTree? tree, | 178 ViewTree? tree, |
| 164 uint32 focused_view); | 179 uint32 focused_view, |
| 180 uint32 access_policy); | |
| 165 | 181 |
| 166 // Invoked when the application embedded at |view| is disconnected. | 182 // Invoked when the application embedded at |view| is disconnected. |
| 167 OnEmbeddedAppDisconnected(uint32 view); | 183 OnEmbeddedAppDisconnected(uint32 view); |
| 168 | 184 |
| 169 // Sent when another connection is embedded in the View this connection was | 185 // Sent when another connection is embedded in the View this connection was |
| 170 // previously embedded in. See Embed() for more information. | 186 // previously embedded in. See Embed() for more information. |
| 171 OnUnembed(); | 187 OnUnembed(); |
| 172 | 188 |
| 173 // Invoked when a view's bounds have changed. | 189 // Invoked when a view's bounds have changed. |
| 174 OnViewBoundsChanged(uint32 view, | 190 OnViewBoundsChanged(uint32 view, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 216 | 232 |
| 217 // Invoked when a view property is changed. If this change is a removal, | 233 // Invoked when a view property is changed. If this change is a removal, |
| 218 // |new_data| is null. | 234 // |new_data| is null. |
| 219 OnViewSharedPropertyChanged(uint32 view, string name, array<uint8>? new_data); | 235 OnViewSharedPropertyChanged(uint32 view, string name, array<uint8>? new_data); |
| 220 | 236 |
| 221 // Invoked when an event is targeted at the specified view. | 237 // Invoked when an event is targeted at the specified view. |
| 222 OnViewInputEvent(uint32 view, mojo.Event event) => (); | 238 OnViewInputEvent(uint32 view, mojo.Event event) => (); |
| 223 | 239 |
| 224 OnViewFocused(uint32 focused_view_id); | 240 OnViewFocused(uint32 focused_view_id); |
| 225 }; | 241 }; |
| OLD | NEW |