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/surfaces/public/interfaces/surface_id.mojom"; | 7 import "components/surfaces/public/interfaces/surface_id.mojom"; |
8 import "components/view_manager/public/interfaces/native_viewport.mojom"; | 8 import "components/view_manager/public/interfaces/native_viewport.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"; |
| 11 import "network/public/interfaces/url_loader.mojom"; |
11 import "ui/mojo/events/input_events.mojom"; | 12 import "ui/mojo/events/input_events.mojom"; |
12 import "ui/mojo/geometry/geometry.mojom"; | 13 import "ui/mojo/geometry/geometry.mojom"; |
13 | 14 |
14 struct ViewData { | 15 struct ViewData { |
15 uint32 parent_id; | 16 uint32 parent_id; |
16 uint32 view_id; | 17 uint32 view_id; |
17 mojo.Rect bounds; | 18 mojo.Rect bounds; |
18 map<string, array<uint8>> properties; | 19 map<string, array<uint8>> properties; |
19 // True if this view is visible. The view may not be drawn on screen (see | 20 // True if this view is visible. The view may not be drawn on screen (see |
20 // drawn for specifics). | 21 // drawn for specifics). |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 // case an empty vector is returned. The views are visited using a depth first | 102 // case an empty vector is returned. The views are visited using a depth first |
102 // search (pre-order). | 103 // search (pre-order). |
103 GetViewTree(uint32 view_id) => (array<ViewData> views); | 104 GetViewTree(uint32 view_id) => (array<ViewData> views); |
104 | 105 |
105 // Shows the surface in the specified view. | 106 // Shows the surface in the specified view. |
106 SetViewSurfaceId(uint32 view_id, SurfaceId surface_id) => (bool success); | 107 SetViewSurfaceId(uint32 view_id, SurfaceId surface_id) => (bool success); |
107 | 108 |
108 // A connection may grant access to a view from another connection by way of | 109 // A connection may grant access to a view from another connection by way of |
109 // the embed functions. There are two variants of this call: | 110 // the embed functions. There are two variants of this call: |
110 // | 111 // |
111 // . EmbedUrl: the ViewManager connects to the app at the supplied url and | 112 // . EmbedRequest: the ViewManager connects to the app at the supplied request |
112 // asks it for a ViewManagerClient. | 113 // and asks it for a ViewManagerClient. |
113 // . With the second variant a ViewManagerClient is directly supplied. | 114 // . With the second variant a ViewManagerClient is directly supplied. |
114 // | 115 // |
115 // In both cases the new ViewManagerClient is configured with a root of | 116 // In both cases the new ViewManagerClient is configured with a root of |
116 // |view_id|. | 117 // |view_id|. |
117 // | 118 // |
118 // The caller must have created |view_id|. If not the request fails and the | 119 // The caller must have created |view_id|. If not the request fails and the |
119 // response is false. | 120 // response is false. |
120 // | 121 // |
121 // A view may only be a root of one connection at a time. Subsequent calls to | 122 // A view may only be a root of one connection at a time. Subsequent calls to |
122 // Embed() for the same view result in the view being removed from the | 123 // Embed() for the same view result in the view being removed from the |
123 // currently embedded app. The embedded app is told this by way of | 124 // currently embedded app. The embedded app is told this by way of |
124 // OnViewDeleted(). | 125 // OnViewDeleted(). |
125 // | 126 // |
126 // The embedder can detect when the embedded app disconnects by way of | 127 // The embedder can detect when the embedded app disconnects by way of |
127 // OnEmbeddedAppDisconnected(). | 128 // OnEmbeddedAppDisconnected(). |
128 // | 129 // |
129 // When a connection embeds an app the connection no longer has priviledges | 130 // When a connection embeds an app the connection no longer has priviledges |
130 // to access or see any of the children of the view. If the view had existing | 131 // to access or see any of the children of the view. If the view had existing |
131 // children the children are removed. The one exception is the root | 132 // children the children are removed. The one exception is the root |
132 // connection. | 133 // connection. |
133 // | 134 // |
134 // |services| encapsulates services offered by the embedder to the embedded | 135 // |services| encapsulates services offered by the embedder to the embedded |
135 // app alongside this Embed() call. |exposed_services| provides a means for | 136 // app alongside this Embed() call. |exposed_services| provides a means for |
136 // the embedder to connect to services exposed by the embedded app. Note that | 137 // the embedder to connect to services exposed by the embedded app. Note that |
137 // if a different app is subsequently embedded at |view_id| the | 138 // if a different app is subsequently embedded at |view_id| the |
138 // ServiceProvider connections to its client in the embedded app and any | 139 // ServiceProvider connections to its client in the embedded app and any |
139 // services it provided are not broken and continue to be valid. | 140 // services it provided are not broken and continue to be valid. |
140 EmbedUrl(string url, | 141 EmbedRequest(URLRequest request, |
141 uint32 view_id, | 142 uint32 view_id, |
142 ServiceProvider&? services, | 143 ServiceProvider&? services, |
143 ServiceProvider? exposed_services) => (bool success); | 144 ServiceProvider? exposed_services) => (bool success); |
144 Embed(uint32 view_id, ViewManagerClient client) => (bool success); | 145 Embed(uint32 view_id, ViewManagerClient client) => (bool success); |
145 | 146 |
146 SetFocus(uint32 view_id) => (bool success); | 147 SetFocus(uint32 view_id) => (bool success); |
147 }; | 148 }; |
148 | 149 |
149 // Changes to views are not sent to the connection that originated the | 150 // Changes to views are not sent to the connection that originated the |
150 // change. For example, if connection 1 changes the bounds of a view by calling | 151 // change. For example, if connection 1 changes the bounds of a view by calling |
151 // SetBounds(), connection 1 does not receive OnViewBoundsChanged(). | 152 // SetBounds(), connection 1 does not receive OnViewBoundsChanged(). |
152 interface ViewManagerClient { | 153 interface ViewManagerClient { |
153 // Invoked when the client application has been embedded at |root|. | 154 // Invoked when the client application has been embedded at |root|. |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 | 212 |
212 // Invoked when a view property is changed. If this change is a removal, | 213 // Invoked when a view property is changed. If this change is a removal, |
213 // |new_data| is null. | 214 // |new_data| is null. |
214 OnViewSharedPropertyChanged(uint32 view, string name, array<uint8>? new_data); | 215 OnViewSharedPropertyChanged(uint32 view, string name, array<uint8>? new_data); |
215 | 216 |
216 // Invoked when an event is targeted at the specified view. | 217 // Invoked when an event is targeted at the specified view. |
217 OnViewInputEvent(uint32 view, mojo.Event event) => (); | 218 OnViewInputEvent(uint32 view, mojo.Event event) => (); |
218 | 219 |
219 OnViewFocused(uint32 focused_view_id); | 220 OnViewFocused(uint32 focused_view_id); |
220 }; | 221 }; |
OLD | NEW |