Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: components/view_manager/public/interfaces/view_tree.mojom

Issue 1317713006: Changes around how embed roots are set (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge to trunk Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 enum AccessPolicy {
48 DEFAULT = 0,
49
50 // An embed root has the following abilities:
51 // . The app sees all the descendants of the view the app is ebmedded at,
52 // even those from separate connections.
53 // . The app is able to Embed() in all the descendants of the view the app
54 // is embedded at, even those from separate connections.
55 // Only connections originating from the ViewTreeHostFactory can grant this
56 // policy.
57 EMBED_ROOT = 1,
58 };
59
47 // Creates a new view with the specified id. It is up to the client to ensure 60 // 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). 61 // 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 62 // Additionally the connection id (embedded in |view_id|) must match that of
50 // the connection. 63 // the connection.
51 // Errors: 64 // Errors:
52 // ERROR_CODE_VALUE_IN_USE: a view already exists with the specified id. 65 // 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 66 // ERROR_CODE_ILLEGAL_ARGUMENT: The connection part of |view_id| does not
54 // match the connection id of the client. 67 // match the connection id of the client.
55 // 68 //
56 // TODO(erg): Once we have default values in mojo, make this take a map of 69 // 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
106 ReorderView(uint32 view_id, 119 ReorderView(uint32 view_id,
107 uint32 relative_view_id, 120 uint32 relative_view_id,
108 OrderDirection direction) => (bool success); 121 OrderDirection direction) => (bool success);
109 122
110 // Returns the views comprising the tree starting at |view_id|. |view_id| is 123 // 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 124 // 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 125 // case an empty vector is returned. The views are visited using a depth first
113 // search (pre-order). 126 // search (pre-order).
114 GetViewTree(uint32 view_id) => (array<ViewData> views); 127 GetViewTree(uint32 view_id) => (array<ViewData> views);
115 128
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 129 // 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 130 // Embed(). Embed() results in a new ViewTreeClient configured with a root of
121 // |view_id|. 131 // |view_id|.
122 // 132 //
123 // The caller must have created |view_id|. If not the request fails and the 133 // The caller must have created |view_id|. If not the request fails and the
124 // response is false. 134 // response is false.
125 // 135 //
126 // A view may only have one embedding in it at a time. Subsequent calls to 136 // 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 137 // Embed() for the same view result in the currently embedded
128 // ViewTreeClient being removed. The embedded app is told this by way of 138 // ViewTreeClient being removed. The embedded app is told this by way of
129 // OnUnembed(), which is followed by OnViewDeleted() (as the connection no 139 // OnUnembed(), which is followed by OnViewDeleted() (as the connection no
130 // longer has access to the view). 140 // longer has access to the view).
131 // 141 //
132 // The embedder can detect when the embedded app disconnects by way of 142 // The embedder can detect when the embedded app disconnects by way of
133 // OnEmbeddedAppDisconnected(). 143 // OnEmbeddedAppDisconnected().
134 // 144 //
135 // When a connection embeds an app the connection no longer has privileges 145 // 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 146 // 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 147 // 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 148 // connection and any connections with the policy ACCESS_POLICY_EMBED_ROOT.
139 // embed roots see the complete tree at their embed point.
140 Embed(uint32 view_id, ViewTreeClient client) => (bool success); 149 Embed(uint32 view_id, ViewTreeClient client) => (bool success);
141 150
142 SetFocus(uint32 view_id); 151 SetFocus(uint32 view_id);
143 152
144 // Set text input state for the given view. 153 // Set text input state for the given view.
145 SetViewTextInputState(uint32 view_id, TextInputState state); 154 SetViewTextInputState(uint32 view_id, TextInputState state);
146 155
147 // Set the input method editor UI (software keyboard, etc) visibility. 156 // 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. 157 // If state is non-null, the specified view's text input state is updated.
149 // Otherwise the existing state is used. 158 // Otherwise the existing state is used.
150 SetImeVisibility(uint32 view_id, bool visible, TextInputState? state); 159 SetImeVisibility(uint32 view_id, bool visible, TextInputState? state);
160
161 // Sets the access policy for the next ViewTreeClient embedded in |view_id|.
162 //
163 // Not all connections are allowed to change the access policy. See each
164 // constant for specifics.
165 //
166 // policy_bitmask is a bitmask of the kAccessPolicy constants. See them for
167 // details.
168 SetAccessPolicy(uint32 view_id, uint32 policy_bitmask);
151 }; 169 };
152 170
153 // Changes to views are not sent to the connection that originated the 171 // 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 172 // change. For example, if connection 1 changes the bounds of a view by calling
155 // SetBounds(), connection 1 does not receive OnViewBoundsChanged(). 173 // SetBounds(), connection 1 does not receive OnViewBoundsChanged().
156 interface ViewTreeClient { 174 interface ViewTreeClient {
157 // Invoked when the client application has been embedded at |root|. 175 // 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 176 // 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 177 // the view manager service, unless the connection is to the root connection
160 // in which case it will be null. 178 // in which case it will be null.
161 OnEmbed(uint16 connection_id, 179 OnEmbed(uint16 connection_id,
162 ViewData root, 180 ViewData root,
163 ViewTree? tree, 181 ViewTree? tree,
164 uint32 focused_view); 182 uint32 focused_view,
183 uint32 access_policy);
165 184
166 // Invoked when the application embedded at |view| is disconnected. 185 // Invoked when the application embedded at |view| is disconnected.
167 OnEmbeddedAppDisconnected(uint32 view); 186 OnEmbeddedAppDisconnected(uint32 view);
168 187
169 // Sent when another connection is embedded in the View this connection was 188 // Sent when another connection is embedded in the View this connection was
170 // previously embedded in. See Embed() for more information. 189 // previously embedded in. See Embed() for more information.
171 OnUnembed(); 190 OnUnembed();
172 191
173 // Invoked when a view's bounds have changed. 192 // Invoked when a view's bounds have changed.
174 OnViewBoundsChanged(uint32 view, 193 OnViewBoundsChanged(uint32 view,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 235
217 // Invoked when a view property is changed. If this change is a removal, 236 // Invoked when a view property is changed. If this change is a removal,
218 // |new_data| is null. 237 // |new_data| is null.
219 OnViewSharedPropertyChanged(uint32 view, string name, array<uint8>? new_data); 238 OnViewSharedPropertyChanged(uint32 view, string name, array<uint8>? new_data);
220 239
221 // Invoked when an event is targeted at the specified view. 240 // Invoked when an event is targeted at the specified view.
222 OnViewInputEvent(uint32 view, mojo.Event event) => (); 241 OnViewInputEvent(uint32 view, mojo.Event event) => ();
223 242
224 OnViewFocused(uint32 focused_view_id); 243 OnViewFocused(uint32 focused_view_id);
225 }; 244 };
OLDNEW
« no previous file with comments | « components/view_manager/public/cpp/view_tree_connection.h ('k') | components/view_manager/server_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698