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/surface_id.mojom"; | 7 import "components/view_manager/public/interfaces/surface_id.mojom"; |
8 import "components/view_manager/public/interfaces/view_manager_constants.mojom"; | 8 import "components/view_manager/public/interfaces/view_manager_constants.mojom"; |
9 import "mojo/application/public/interfaces/service_provider.mojom"; | 9 import "mojo/application/public/interfaces/service_provider.mojom"; |
10 import "network/public/interfaces/url_loader.mojom"; | 10 import "network/public/interfaces/url_loader.mojom"; |
(...skipping 24 matching lines...) Expand all Loading... |
35 enum ErrorCode { | 35 enum ErrorCode { |
36 NONE, | 36 NONE, |
37 VALUE_IN_USE, | 37 VALUE_IN_USE, |
38 ILLEGAL_ARGUMENT, | 38 ILLEGAL_ARGUMENT, |
39 }; | 39 }; |
40 | 40 |
41 // Views are identified by a uint32. The upper 16 bits are the connection id, | 41 // Views are identified by a uint32. The upper 16 bits are the connection id, |
42 // and the lower 16 the id assigned by the client. | 42 // and the lower 16 the id assigned by the client. |
43 // | 43 // |
44 // The root view is identified with a connection id of 0, and value of 1. | 44 // The root view is identified with a connection id of 0, and value of 1. |
45 interface ViewManagerService { | 45 interface ViewTree { |
46 // Creates a new view with the specified id. It is up to the client to ensure | 46 // Creates a new view with the specified id. It is up to the client to ensure |
47 // 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). |
48 // Additionally the connection id (embedded in |view_id|) must match that of | 48 // Additionally the connection id (embedded in |view_id|) must match that of |
49 // the connection. | 49 // the connection. |
50 // Errors: | 50 // Errors: |
51 // ERROR_CODE_VALUE_IN_USE: a view already exists with the specified id. | 51 // ERROR_CODE_VALUE_IN_USE: a view already exists with the specified id. |
52 // ERROR_CODE_ILLEGAL_ARGUMENT: The connection part of |view_id| does not | 52 // ERROR_CODE_ILLEGAL_ARGUMENT: The connection part of |view_id| does not |
53 // match the connection id of the client. | 53 // match the connection id of the client. |
54 // | 54 // |
55 // TODO(erg): Once we have default values in mojo, make this take a map of | 55 // 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... |
105 | 105 |
106 // Returns the views comprising the tree starting at |view_id|. |view_id| is | 106 // Returns the views comprising the tree starting at |view_id|. |view_id| is |
107 // the first result in the return value, unless |view_id| is invalid, in which | 107 // the first result in the return value, unless |view_id| is invalid, in which |
108 // case an empty vector is returned. The views are visited using a depth first | 108 // case an empty vector is returned. The views are visited using a depth first |
109 // search (pre-order). | 109 // search (pre-order). |
110 GetViewTree(uint32 view_id) => (array<ViewData> views); | 110 GetViewTree(uint32 view_id) => (array<ViewData> views); |
111 | 111 |
112 // Shows the surface in the specified view. | 112 // Shows the surface in the specified view. |
113 SetViewSurfaceId(uint32 view_id, SurfaceId surface_id) => (bool success); | 113 SetViewSurfaceId(uint32 view_id, SurfaceId surface_id) => (bool success); |
114 | 114 |
115 // Tells the ViewManagerService that the ViewManagerClient wants to get | 115 // Tells the ViewTree that the ViewTreeClient wants to get |
116 // OnEmbedForDescendant() when EmbedAllowingReembed() is invoked on any | 116 // OnEmbedForDescendant() when EmbedAllowingReembed() is invoked on any |
117 // descendant Views. | 117 // descendant Views. |
118 // | 118 // |
119 // See Embed() docs for more details. | 119 // See Embed() docs for more details. |
120 // | 120 // |
121 // TODO(sky): this needs to be restricted in some way. Maybe the root can | 121 // TODO(sky): this needs to be restricted in some way. Maybe the root can |
122 // grant this ability? | 122 // grant this ability? |
123 SetEmbedRoot(); | 123 SetEmbedRoot(); |
124 | 124 |
125 // A connection may grant access to a view from another connection by way of | 125 // A connection may grant access to a view from another connection by way of |
126 // the embed functions. The following variants exist: | 126 // the embed functions. The following variants exist: |
127 // | 127 // |
128 // . Embed: the client supplies the ViewManagerClient to embed. | 128 // . Embed: the client supplies the ViewTreeClient to embed. |
129 // . EmbedAllowingReembed: walks the view tree for the first embed root | 129 // . EmbedAllowingReembed: walks the view tree for the first embed root |
130 // ancestor and asks it to perform the embed (OnEmbedForDescendant()). | 130 // ancestor and asks it to perform the embed (OnEmbedForDescendant()). |
131 // The embed root ancestor may allow or disallow the request. If there is no | 131 // The embed root ancestor may allow or disallow the request. If there is no |
132 // embed root ancestor ViewManager connects to the application and requests | 132 // embed root ancestor ViewManager connects to the application and requests |
133 // a ViewManagerClient from it. | 133 // a ViewTreeClient from it. |
134 // | 134 // |
135 // In all cases the new ViewManagerClient is configured with a root of | 135 // In all cases the new ViewTreeClient is configured with a root of |view_id|. |
136 // |view_id|. | |
137 // | 136 // |
138 // The caller must have created |view_id|. If not the request fails and the | 137 // The caller must have created |view_id|. If not the request fails and the |
139 // response is false. | 138 // response is false. |
140 // | 139 // |
141 // A view may only have one embedding in it at a time. Subsequent calls to | 140 // A view may only have one embedding in it at a time. Subsequent calls to |
142 // Embed() for the same view result in the currently embedded | 141 // Embed() for the same view result in the currently embedded |
143 // ViewManagerClient being removed. The embedded app is told this by way of | 142 // ViewTreeClient being removed. The embedded app is told this by way of |
144 // OnUnembed(), which is followed by OnViewDeleted() (as the connection no | 143 // OnUnembed(), which is followed by OnViewDeleted() (as the connection no |
145 // longer has access to the view). | 144 // longer has access to the view). |
146 // | 145 // |
147 // The embedder can detect when the embedded app disconnects by way of | 146 // The embedder can detect when the embedded app disconnects by way of |
148 // OnEmbeddedAppDisconnected(). | 147 // OnEmbeddedAppDisconnected(). |
149 // | 148 // |
150 // When a connection embeds an app the connection no longer has privileges | 149 // When a connection embeds an app the connection no longer has privileges |
151 // to access or see any of the children of the view. If the view had existing | 150 // to access or see any of the children of the view. If the view had existing |
152 // children the children are removed. The one exception is the root | 151 // children the children are removed. The one exception is the root |
153 // connection and any embed roots. The root always see the full tree, and | 152 // connection and any embed roots. The root always see the full tree, and |
154 // embed roots see the complete tree at their embed point. | 153 // embed roots see the complete tree at their embed point. |
155 Embed(uint32 view_id, ViewManagerClient client) => (bool success); | 154 Embed(uint32 view_id, ViewTreeClient client) => (bool success); |
156 EmbedAllowingReembed(uint32 view_id, URLRequest request) => (bool success); | 155 EmbedAllowingReembed(uint32 view_id, URLRequest request) => (bool success); |
157 | 156 |
158 SetFocus(uint32 view_id) => (bool success); | 157 SetFocus(uint32 view_id) => (bool success); |
159 | 158 |
160 // Set text input state for the given view. | 159 // Set text input state for the given view. |
161 SetViewTextInputState(uint32 view_id, TextInputState state); | 160 SetViewTextInputState(uint32 view_id, TextInputState state); |
162 | 161 |
163 // Set the input method editor UI (software keyboard, etc) visibility. | 162 // Set the input method editor UI (software keyboard, etc) visibility. |
164 // If state is non-null, the specified view's text input state is updated. | 163 // If state is non-null, the specified view's text input state is updated. |
165 // Otherwise the existing state is used. | 164 // Otherwise the existing state is used. |
166 SetImeVisibility(uint32 view_id, bool visible, TextInputState? state); | 165 SetImeVisibility(uint32 view_id, bool visible, TextInputState? state); |
167 }; | 166 }; |
168 | 167 |
169 // 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 |
170 // 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 |
171 // SetBounds(), connection 1 does not receive OnViewBoundsChanged(). | 170 // SetBounds(), connection 1 does not receive OnViewBoundsChanged(). |
172 interface ViewManagerClient { | 171 interface ViewTreeClient { |
173 // Invoked when the client application has been embedded at |root|. | 172 // Invoked when the client application has been embedded at |root|. |
174 // See Embed() on ViewManagerService for more details. |view_manager_service| | 173 // See Embed() on ViewTree for more details. |tree| will be a handle back to |
175 // will be a handle back to the view manager service, unless the connection is | 174 // the view manager service, unless the connection is to the root connection |
176 // to the WindowManager in which case it will be null. | 175 // in which case it will be null. |
177 OnEmbed(uint16 connection_id, | 176 OnEmbed(uint16 connection_id, |
178 ViewData root, | 177 ViewData root, |
179 ViewManagerService? view_manager_service, | 178 ViewTree? tree, |
180 uint32 focused_view); | 179 uint32 focused_view); |
181 | 180 |
182 // Asks the ViewManagerClient that was marked as an embed root for the | 181 // Asks the ViewTreeClient that was marked as an embed root for the |
183 // ViewManagerClient to embed in |view|. The embed can be disallowed by | 182 // ViewTreeClient to embed in |view|. The embed can be disallowed by |
184 // calling the callback with nullptr. | 183 // calling the callback with nullptr. |
185 OnEmbedForDescendant(uint32 view, URLRequest request) => | 184 OnEmbedForDescendant(uint32 view, URLRequest request) => |
186 (ViewManagerClient? client); | 185 (ViewTreeClient? client); |
187 | 186 |
188 // Invoked when the application embedded at |view| is disconnected. | 187 // Invoked when the application embedded at |view| is disconnected. |
189 OnEmbeddedAppDisconnected(uint32 view); | 188 OnEmbeddedAppDisconnected(uint32 view); |
190 | 189 |
191 // Sent when another connection is embedded in the View this connection was | 190 // Sent when another connection is embedded in the View this connection was |
192 // previously embedded in. See Embed() for more information. | 191 // previously embedded in. See Embed() for more information. |
193 OnUnembed(); | 192 OnUnembed(); |
194 | 193 |
195 // Invoked when a view's bounds have changed. | 194 // Invoked when a view's bounds have changed. |
196 OnViewBoundsChanged(uint32 view, | 195 OnViewBoundsChanged(uint32 view, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 | 237 |
239 // Invoked when a view property is changed. If this change is a removal, | 238 // Invoked when a view property is changed. If this change is a removal, |
240 // |new_data| is null. | 239 // |new_data| is null. |
241 OnViewSharedPropertyChanged(uint32 view, string name, array<uint8>? new_data); | 240 OnViewSharedPropertyChanged(uint32 view, string name, array<uint8>? new_data); |
242 | 241 |
243 // Invoked when an event is targeted at the specified view. | 242 // Invoked when an event is targeted at the specified view. |
244 OnViewInputEvent(uint32 view, mojo.Event event) => (); | 243 OnViewInputEvent(uint32 view, mojo.Event event) => (); |
245 | 244 |
246 OnViewFocused(uint32 focused_view_id); | 245 OnViewFocused(uint32 focused_view_id); |
247 }; | 246 }; |
OLD | NEW |