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

Side by Side Diff: mojo/services/ui/views/interfaces/view_trees.mojom

Issue 1410693003: mozart: Introduce new view manager interfaces. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 1 month 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
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 [DartPackage="mojo_services"]
6 module mojo.ui;
7
8 import "mojo/services/ui/views/interfaces/layouts.mojom";
9 import "mojo/services/ui/views/interfaces/views.mojom";
10
11 // A view tree is a top-level container for a hierarchy of views.
12 //
13 // A view tree must registered with the view manager before it can be shown.
14 interface ViewTree {
15 // Called when the tree needs to update its layout.
16 //
17 // This method may be called for one or more of the following reasons:
18 //
19 // 1. The root was just set.
20 // 2. The root produced different layout information during its last
21 // layout pass causing a recursive layout to occur.
22 //
23 // Layout requests are coalesced for efficiency. Certain intermediate
24 // updates may be dropped if the view tree is unable to keep up with them
25 // in a timely manner. Do nothing updates are always dropped.
26 //
27 // The implementation should invoke the callback once the event has
28 // been handled and the view tree is ready to be shown in its new aspect.
29 OnLayout() => ();
30
31 // Called when the root view has become unavailable.
32 //
33 // The root may become unavailable for many reasons such being unregistered
34 // by its application, abnormal termination of its application, or
35 // being reparented into a different view tree.
36 //
37 // The implementation should invoke the callback once the event has
38 // been handled.
39 OnRootUnavailable(uint32 root_key) => ();
40 };
41
42 // The view tree host provides an interface for a view tree to configure itself
43 // and interact with its views.
44 //
45 // Each view tree obtains its own view tree host when registered with the
46 // ViewManager. To unregister the view tree, close its view tree
47 // and/or view tree host message pipes.
48 interface ViewTreeHost {
49 // Requests that the view tree's OnLayout() method be called to compute a
50 // new layout due to a change in the view tree's layout information.
51 RequestLayout();
52
53 // Sets the root of the view tree and assigns it the provided |root_key|
54 // to distinguish it from any other roots this view tree has had.
55 //
56 // It is a good idea to provide a distinct |root_key| each time a new root
57 // is set so that callbacks related to the root can be clearly distinguished
58 // across these changes.
59 //
60 // If |root_view_token| refers to a view which is already unavailable
61 // then the call proceeds as if it succeeded but an OnChildUnavailable()
62 // message will be sent.
63 //
64 // If |root_view_token| refers to a view which already has a parent or is
65 // the root of a view tree then an OnChildUnavailable() or OnRootUnavailable()
66 // message will be sent to its old parent or root and the the view will be
67 // used as the root of the new view tree as usual. This special case also
68 // applies when the specified view is already the root of this view tree, in
69 // which case the behavior is similar to the view having been transferred to
70 // some other view tree and then back again.
71 SetRoot(uint32 root_key, mojo.ui.ViewToken root_view_token);
72
73 // Removes the root of the view tree.
74 //
75 // Does nothing if the view tree currently does not have a root.
76 ResetRoot();
77
78 // Sets the layout parameters of the root of the view tree and retrieves
79 // its layout information.
80 //
81 // The returned |info| is null if this layout request was canceled either
82 // because it has been superceded by a subsequently issued layout request
83 // or because the root has become unavailable.
84 //
85 // It is an error to call this function if the view tree does not currently
86 // have a root; the connection will be closed.
87 //
88 // It is an error to specify malformed |root_layout_params| such
89 // as invalid size constraints; the connection will be closed.
90 LayoutRoot(mojo.ui.ViewLayoutParams root_layout_params) =>
91 (mojo.ui.ViewLayoutInfo? info);
92 };
OLDNEW
« no previous file with comments | « mojo/services/ui/views/interfaces/view_provider.mojom ('k') | mojo/services/ui/views/interfaces/views.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698