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

Unified 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, 2 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 side-by-side diff with in-line comments
Download patch
Index: mojo/services/ui/views/interfaces/view_trees.mojom
diff --git a/mojo/services/ui/views/interfaces/view_trees.mojom b/mojo/services/ui/views/interfaces/view_trees.mojom
new file mode 100644
index 0000000000000000000000000000000000000000..ac3439c11b8e27677d3a0e5cf9cdbb1940a0581c
--- /dev/null
+++ b/mojo/services/ui/views/interfaces/view_trees.mojom
@@ -0,0 +1,92 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+[DartPackage="mojo_services"]
+module mojo.ui;
+
+import "mojo/services/ui/views/interfaces/layouts.mojom";
+import "mojo/services/ui/views/interfaces/views.mojom";
+
+// A view tree is a top-level container for a hierarchy of views.
+//
+// A view tree must registered with the view manager before it can be shown.
+interface ViewTree {
+ // Called when the tree needs to update its layout.
+ //
+ // This method may be called for one or more of the following reasons:
+ //
+ // 1. The root was just set.
+ // 2. The root produced different layout information during its last
+ // layout pass causing a recursive layout to occur.
+ //
+ // Layout requests are coalesced for efficiency. Certain intermediate
+ // updates may be dropped if the view tree is unable to keep up with them
+ // in a timely manner. Do nothing updates are always dropped.
+ //
+ // The implementation should invoke the callback once the event has
+ // been handled and the view tree is ready to be shown in its new aspect.
+ OnLayout() => ();
+
+ // Called when the root view has become unavailable.
+ //
+ // The root may become unavailable for many reasons such being unregistered
+ // by its application, abnormal termination of its application, or
+ // being reparented into a different view tree.
+ //
+ // The implementation should invoke the callback once the event has
+ // been handled.
+ OnRootUnavailable(uint32 root_key) => ();
+};
+
+// The view tree host provides an interface for a view tree to configure itself
+// and interact with its views.
+//
+// Each view tree obtains its own view tree host when registered with the
+// ViewManager. To unregister the view tree, close its view tree
+// and/or view tree host message pipes.
+interface ViewTreeHost {
+ // Requests that the view tree's OnLayout() method be called to compute a
+ // new layout due to a change in the view tree's layout information.
+ RequestLayout();
+
+ // Sets the root of the view tree and assigns it the provided |root_key|
+ // to distinguish it from any other roots this view tree has had.
+ //
+ // It is a good idea to provide a distinct |root_key| each time a new root
+ // is set so that callbacks related to the root can be clearly distinguished
+ // across these changes.
+ //
+ // If |root_view_token| refers to a view which is already unavailable
+ // then the call proceeds as if it succeeded but an OnChildUnavailable()
+ // message will be sent.
+ //
+ // If |root_view_token| refers to a view which already has a parent or is
+ // the root of a view tree then an OnChildUnavailable() or OnRootUnavailable()
+ // message will be sent to its old parent or root and the the view will be
+ // used as the root of the new view tree as usual. This special case also
+ // applies when the specified view is already the root of this view tree, in
+ // which case the behavior is similar to the view having been transferred to
+ // some other view tree and then back again.
+ SetRoot(uint32 root_key, mojo.ui.ViewToken root_view_token);
+
+ // Removes the root of the view tree.
+ //
+ // Does nothing if the view tree currently does not have a root.
+ ResetRoot();
+
+ // Sets the layout parameters of the root of the view tree and retrieves
+ // its layout information.
+ //
+ // The returned |info| is null if this layout request was canceled either
+ // because it has been superceded by a subsequently issued layout request
+ // or because the root has become unavailable.
+ //
+ // It is an error to call this function if the view tree does not currently
+ // have a root; the connection will be closed.
+ //
+ // It is an error to specify malformed |root_layout_params| such
+ // as invalid size constraints; the connection will be closed.
+ LayoutRoot(mojo.ui.ViewLayoutParams root_layout_params) =>
+ (mojo.ui.ViewLayoutInfo? info);
+};
« 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