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

Side by Side Diff: mojo/services/public/interfaces/view_manager/view_manager.mojom

Issue 460863002: Rename Node to View in the View Manager mojom & client lib. Service TBD. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 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 | Annotate | Revision Log
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 import "mojo/public/interfaces/application/service_provider.mojom" 5 import "mojo/public/interfaces/application/service_provider.mojom"
6 import "mojo/services/public/interfaces/geometry/geometry.mojom" 6 import "mojo/services/public/interfaces/geometry/geometry.mojom"
7 import "mojo/services/public/interfaces/input_events/input_events.mojom" 7 import "mojo/services/public/interfaces/input_events/input_events.mojom"
8 import "mojo/services/public/interfaces/view_manager/view_manager_constants.mojo m" 8 import "mojo/services/public/interfaces/view_manager/view_manager_constants.mojo m"
9 9
10 module mojo { 10 module mojo {
11 11
12 struct NodeData { 12 struct ViewData {
13 uint32 parent_id; 13 uint32 parent_id;
14 uint32 node_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 { 19 enum ErrorCode {
20 NONE, 20 NONE,
21 VALUE_IN_USE, 21 VALUE_IN_USE,
22 ILLEGAL_ARGUMENT, 22 ILLEGAL_ARGUMENT,
23 }; 23 };
24 24
25 // ViewManagerInitService is used to grant an application a connection to the 25 // ViewManagerInitService is used to grant an application a connection to the
26 // ViewManager by embedding it at an approriate Node. 26 // ViewManager by embedding it at an approriate View.
27 interface ViewManagerInitService { 27 interface ViewManagerInitService {
28 // Embed the application @ |url| at an appropriate Node. 28 // Embed the application @ |url| at an appropriate View.
29 // The first time this method is called in the lifetime of a View Manager 29 // The first time this method is called in the lifetime of a View Manager
30 // application instance, the "appropriate Node" is defined as being the 30 // application instance, the "appropriate View" is defined as being the
31 // service root Node. 31 // service root View.
32 // Subsequent times, implementation of this method is delegated to the 32 // Subsequent times, implementation of this method is delegated to the
33 // application embedded at the service root Node. This application is 33 // application embedded at the service root View. This application is
34 // typically referred to as the "window manager", and will have a specific 34 // typically referred to as the "window manager", and will have a specific
35 // definition of where within its Node hierarchy to embed an unparented URL. 35 // definition of where within its View hierarchy to embed an unparented URL.
36 // See ViewManagerService below for more details about |service_provider|. 36 // See ViewManagerService below for more details about |service_provider|.
37 Embed(string url, ServiceProvider service_provider) => (bool success); 37 Embed(string url, ServiceProvider service_provider) => (bool success);
38 }; 38 };
39 39
40 // Nodes are identified by a uint32. The upper 16 bits are the connection id, 40 // Views are identified by a uint32. The upper 16 bits are the connection id,
41 // and the lower 16 the id assigned by the client. 41 // and the lower 16 the id assigned by the client.
42 // 42 //
43 // The root node is identified with a connection id of 0, and value of 1. 43 // The root view is identified with a connection id of 0, and value of 1.
44 [Client=ViewManagerClient] 44 [Client=ViewManagerClient]
45 interface ViewManagerService { 45 interface ViewManagerService {
46 // Creates a new node 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 |node_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 node 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 |node_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 CreateNode(uint32 node_id) => (ErrorCode error_code); 54 CreateView(uint32 view_id) => (ErrorCode error_code);
55 55
56 // Deletes a node. This does not recurse. No hierarchy change notifications 56 // Deletes a view. This does not recurse. No hierarchy change notifications
57 // are sent as a result of this. Only the connection that created the node can 57 // are sent as a result of this. Only the connection that created the view can
58 // delete it. 58 // delete it.
59 DeleteNode(uint32 node_id) => (bool success); 59 DeleteView(uint32 view_id) => (bool success);
60 60
61 // Sets the specified bounds of the specified node. 61 // Sets the specified bounds of the specified view.
62 SetNodeBounds(uint32 node_id, mojo.Rect bounds) => (bool success); 62 SetViewBounds(uint32 view_id, mojo.Rect bounds) => (bool success);
63 63
64 // Sets the visibility of the specified node to |visible|. Connections are 64 // Sets the visibility of the specified view to |visible|. Connections are
65 // allowed to change the visibility of any node they have created, as well as 65 // allowed to change the visibility of any view they have created, as well as
66 // any of their roots. 66 // any of their roots.
67 SetNodeVisibility(uint32 node_id, bool visible) => (bool success); 67 SetViewVisibility(uint32 view_id, bool visible) => (bool success);
68 68
69 // Reparents a node. 69 // Reparents a view.
70 // This fails for any of the following reasons: 70 // This fails for any of the following reasons:
71 // . |parent| or |child| does not identify a valid node. 71 // . |parent| or |child| does not identify a valid view.
72 // . |child| is an ancestor of |parent|. 72 // . |child| is an ancestor of |parent|.
73 // . |child| is already a child of |parent|. 73 // . |child| is already a child of |parent|.
74 // 74 //
75 // This may result in a connection getting OnNodeDeleted(). See 75 // This may result in a connection getting OnViewDeleted(). See
76 // RemoveNodeFromParent for details. 76 // RemoveViewFromParent for details.
77 AddNode(uint32 parent, uint32 child) => (bool success); 77 AddView(uint32 parent, uint32 child) => (bool success);
78 78
79 // Removes a node from its current parent. This fails if the node is not 79 // Removes a view from its current parent. This fails if the view is not
80 // valid or the node already has no parent. 80 // valid or the view already has no parent.
81 // 81 //
82 // Removing a node from a parent may result in OnNodeDeleted() being sent to 82 // Removing a view from a parent may result in OnViewDeleted() being sent to
83 // other connections. For example, connection A has nodes 1 and 2, with 2 a 83 // other connections. For example, connection A has views 1 and 2, with 2 a
84 // child of 1. Connection B has a root 1. If 2 is removed from 1 then B gets 84 // child of 1. Connection B has a root 1. If 2 is removed from 1 then B gets
85 // OnNodeDeleted(). This is done as node 2 is effectively no longer visible to 85 // OnViewDeleted(). This is done as view 2 is effectively no longer visible to
86 // connection B. 86 // connection B.
87 RemoveNodeFromParent(uint32 node_id) => (bool success); 87 RemoveViewFromParent(uint32 view_id) => (bool success);
88 88
89 // Reorders a node in its parent, relative to |relative_node_id| according to 89 // Reorders a view in its parent, relative to |relative_view_id| according to
90 // |direction|. 90 // |direction|.
91 // Only the connection that created the node's parent can reorder its 91 // Only the connection that created the view's parent can reorder its
92 // children. 92 // children.
93 ReorderNode(uint32 node_id, 93 ReorderView(uint32 view_id,
94 uint32 relative_node_id, 94 uint32 relative_view_id,
95 OrderDirection direction) => (bool success); 95 OrderDirection direction) => (bool success);
96 96
97 // Returns the nodes comprising the tree starting at |node_id|. |node_id| is 97 // Returns the views comprising the tree starting at |view_id|. |view_id| is
98 // the first result in the return value, unless |node_id| is invalid, in which 98 // the first result in the return value, unless |view_id| is invalid, in which
99 // case an empty vector is returned. The nodes are visited using a depth first 99 // case an empty vector is returned. The views are visited using a depth first
100 // search (pre-order). 100 // search (pre-order).
101 GetNodeTree(uint32 node_id) => (NodeData[] nodes); 101 GetViewTree(uint32 view_id) => (ViewData[] views);
102 102
103 // Shows the specified image (png encoded) in the specified node. 103 // Shows the specified image (png encoded) in the specified view.
104 SetNodeContents(uint32 node_id, 104 SetViewContents(uint32 view_id,
105 handle<shared_buffer> buffer, 105 handle<shared_buffer> buffer,
106 uint32 buffer_size) => (bool success); 106 uint32 buffer_size) => (bool success);
107 107
108 // Sets focus to the specified node. 108 // Sets focus to the specified view.
109 SetFocus(uint32 node_id) => (bool success); 109 SetFocus(uint32 view_id) => (bool success);
110 110
111 // Embeds the app for |url| in the specified node. More specifically this 111 // Embeds the app for |url| in the specified view. More specifically this
112 // creates a new connection to the specified url, expecting to get a 112 // creates a new connection to the specified url, expecting to get a
113 // ViewManagerClient and configures it with the root node |node|. Fails 113 // ViewManagerClient and configures it with the root view |view|. Fails
114 // if |node| was not created by this connection. 114 // if |view| was not created by this connection.
115 // 115 //
116 // If a particular client invokes Embed() multiple times with the same url, 116 // If a particular client invokes Embed() multiple times with the same url,
117 // the connection is reused. When this happens the ViewManagerClient is 117 // the connection is reused. When this happens the ViewManagerClient is
118 // notified of the additional roots by way of OnEmbed(). 118 // notified of the additional roots by way of OnEmbed().
119 // 119 //
120 // A node may only be a root of one connection at a time. Subsequent calls to 120 // A view may only be a root of one connection at a time. Subsequent calls to
121 // Embed() for the same node result in the node being removed from the 121 // Embed() for the same view result in the view being removed from the
122 // current connection. The current connection is told this by way of 122 // current connection. The current connection is told this by way of
123 // OnNodeDeleted(). 123 // OnViewDeleted().
124 // 124 //
125 // When a connection embeds an app the connection no longer has priviledges 125 // When a connection embeds an app the connection no longer has priviledges
126 // to access or see any of the children of the node. If the node had existing 126 // to access or see any of the children of the view. If the view had existing
127 // children the children are removed. The one exception is the root 127 // children the children are removed. The one exception is the root
128 // connection. 128 // connection.
129 // 129 //
130 // If |node_id| is 0, the View Manager delegates determination of what node to 130 // If |view_id| is 0, the View Manager delegates determination of what view to
131 // embed |url| at to the app embedded at the service root node (i.e. the 131 // embed |url| at to the app embedded at the service root view (i.e. the
132 // window manager). 132 // window manager).
133 // 133 //
134 // |service_provider| encapsulates services offered by the embedder to the 134 // |service_provider| encapsulates services offered by the embedder to the
135 // embedded app alongside this Embed() call. It also provides a means for 135 // embedded app alongside this Embed() call. It also provides a means for
136 // the embedder to connect to services symmetrically exposed by the embedded 136 // the embedder to connect to services symmetrically exposed by the embedded
137 // app. Note that if a different app is subsequently embedded at |node_id| 137 // app. Note that if a different app is subsequently embedded at |view_id|
138 // the |service_provider|'s connection to its client in the embedded app and 138 // the |service_provider|'s connection to its client in the embedded app and
139 // any services it provided are not broken and continue to be valid. 139 // any services it provided are not broken and continue to be valid.
140 Embed(string url, 140 Embed(string url,
141 uint32 node_id, 141 uint32 view_id,
142 ServiceProvider service_provider) => (bool success); 142 ServiceProvider service_provider) => (bool success);
143 143
144 // TODO(sky): move these to a separate interface when FIFO works. 144 // TODO(sky): move these to a separate interface when FIFO works.
145 145
146 // Sends OnNodeInputEvent() to the owner of the specified node. 146 // Sends OnViewInputEvent() to the owner of the specified view.
147 DispatchOnNodeInputEvent(uint32 node_id, mojo.Event event); 147 DispatchOnViewInputEvent(uint32 view_id, mojo.Event event);
148 }; 148 };
149 149
150 // Changes to nodes are not sent to the connection that originated the 150 // Changes to views are not sent to the connection that originated the
151 // change. For example, if connection 1 changes the bounds of a node by calling 151 // change. For example, if connection 1 changes the bounds of a view by calling
152 // SetBounds(), connection 1 does not receive OnNodeBoundsChanged(). 152 // SetBounds(), connection 1 does not receive OnViewBoundsChanged().
153 [Client=ViewManagerService] 153 [Client=ViewManagerService]
154 interface ViewManagerClient { 154 interface ViewManagerClient {
155 // Invoked when the client application has been embedded at |root|. 155 // Invoked when the client application has been embedded at |root|.
156 // See Embed() on ViewManagerService for more details. 156 // See Embed() on ViewManagerService for more details.
157 OnEmbed(uint16 connection_id, 157 OnEmbed(uint16 connection_id,
158 string embedder_url, 158 string embedder_url,
159 NodeData root, 159 ViewData root,
160 ServiceProvider& service_provider); 160 ServiceProvider& service_provider);
161 161
162 // Invoked when a node's bounds have changed. 162 // Invoked when a view's bounds have changed.
163 OnNodeBoundsChanged(uint32 node, mojo.Rect old_bounds, mojo.Rect new_bounds); 163 OnViewBoundsChanged(uint32 view, mojo.Rect old_bounds, mojo.Rect new_bounds);
164 164
165 // Invoked when a change is done to the hierarchy. A value of 0 is used to 165 // Invoked when a change is done to the hierarchy. A value of 0 is used to
166 // identify a null node. For example, if the old_parent is NULL, 0 is 166 // identify a null view. For example, if the old_parent is NULL, 0 is
167 // supplied. 167 // supplied.
168 // |nodes| contains any nodes that are that the client has not been told 168 // |views| contains any views that are that the client has not been told
169 // about. This is not sent for hierarchy changes of nodes not known to this 169 // about. This is not sent for hierarchy changes of views not known to this
170 // client or not attached to the tree. 170 // client or not attached to the tree.
171 OnNodeHierarchyChanged(uint32 node, 171 OnViewHierarchyChanged(uint32 view,
172 uint32 new_parent, 172 uint32 new_parent,
173 uint32 old_parent, 173 uint32 old_parent,
174 NodeData[] nodes); 174 ViewData[] views);
175 175
176 // Invoked when the order of nodes within a parent changes. 176 // Invoked when the order of views within a parent changes.
177 OnNodeReordered(uint32 node_id, 177 OnViewReordered(uint32 view_id,
178 uint32 relative_node_id, 178 uint32 relative_view_id,
179 OrderDirection direction); 179 OrderDirection direction);
180 180
181 // Invoked when a node is deleted. 181 // Invoked when a view is deleted.
182 OnNodeDeleted(uint32 node); 182 OnViewDeleted(uint32 view);
183 183
184 // Invoked when an event is targeted at the specified node. 184 // Invoked when an event is targeted at the specified view.
185 OnNodeInputEvent(uint32 node, mojo.Event event) => (); 185 OnViewInputEvent(uint32 view, mojo.Event event) => ();
186 186
187 // Invoked when focus shifts from one Node to another. |gained_focus_id| is 187 // Invoked when focus shifts from one View to another. |gained_focus_id| is
188 // the id of the node that gained focus, or 0 if the node that gained focus is 188 // the id of the view that gained focus, or 0 if the view that gained focus is
189 // not known to this connection. |lost_focus_id| is likewise the node that 189 // not known to this connection. |lost_focus_id| is likewise the view that
190 // lost focus. 190 // lost focus.
191 // TODO(beng): once aura is removed from the service, focus management should 191 // TODO(beng): once aura is removed from the service, focus management should
192 // entirely move to the window manager and this method can be 192 // entirely move to the window manager and this method can be
193 // removed. 193 // removed.
194 OnFocusChanged(uint32 gained_focus_id, uint32 lost_focus_id); 194 OnFocusChanged(uint32 gained_focus_id, uint32 lost_focus_id);
195 195
196 // TODO(sky): The following methods represent an interface between the view 196 // TODO(sky): The following methods represent an interface between the view
197 // manager and the application embedded at the service root node 197 // manager and the application embedded at the service root view
198 // (i.e. the window manager). These methods are not called on 198 // (i.e. the window manager). These methods are not called on
199 // any other clients. They should be moved to a separate interface 199 // any other clients. They should be moved to a separate interface
200 // once support for derived FIFOs is landed. 200 // once support for derived FIFOs is landed.
201 201
202 // Requests the window manager create a "top level" node embedding |url|. 202 // Requests the window manager create a "top level" view embedding |url|.
203 Embed(string url, ServiceProvider& service_provider); 203 Embed(string url, ServiceProvider& service_provider);
204 204
205 // Requests the view manager dispatch the event targeted at |node|. 205 // Requests the view manager dispatch the event targeted at |view|.
206 DispatchOnNodeInputEvent(uint32 node, mojo.Event event); 206 DispatchOnViewInputEvent(uint32 view, mojo.Event event);
207 }; 207 };
208 208
209 } 209 }
OLDNEW
« no previous file with comments | « mojo/services/public/cpp/view_manager/window_manager_delegate.h ('k') | mojo/services/view_manager/root_node_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698