| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 [DartPackage="mojo_services"] | 5 [DartPackage="mojo_services"] |
| 6 module mojo.ui; | 6 module mojo.ui; |
| 7 | 7 |
| 8 import "mojo/services/ui/views/interfaces/views.mojom"; | 8 import "mojo/services/ui/views/interfaces/views.mojom"; |
| 9 import "mojo/services/ui/views/interfaces/view_associates.mojom"; |
| 9 import "mojo/services/ui/views/interfaces/view_trees.mojom"; | 10 import "mojo/services/ui/views/interfaces/view_trees.mojom"; |
| 10 | 11 |
| 12 // Maximum length for a view or view tree label. |
| 13 const uint32 kLabelMaxLength = 32; |
| 14 |
| 11 // The view manager is a service which manages trees of views. | 15 // The view manager is a service which manages trees of views. |
| 12 // | 16 // |
| 13 // Before a view can be added to the view tree, it must first be registered | 17 // Before a view can be added to the view tree, it must first be registered |
| 14 // with the view manager. Once registered, the view receives a token as a | 18 // with the view manager. Once registered, the view receives a token as a |
| 15 // transferable reference to be provided to the view's intended container. | 19 // transferable reference to be provided to the view's intended container. |
| 16 [ServiceName="mojo::ui::ViewManager"] | 20 [ServiceName="mojo::ui::ViewManager"] |
| 17 interface ViewManager { | 21 interface ViewManager { |
| 18 // Registers a view with the view manager. | 22 // Registers a view with the view manager. |
| 19 // | 23 // |
| 20 // When a view is registered, it receives its own host and a token | 24 // When a view is registered, it receives its own host and a token |
| 21 // to identify it. | 25 // to identify it. |
| 22 // | 26 // |
| 23 // The |view_host| is used to configure the view and interact with its | 27 // The |view_host| is used to configure the view and interact with its |
| 24 // local environment. The view host is private to the view and should | 28 // local environment. The view host is private to the view and should |
| 25 // not be shared with anyone else. | 29 // not be shared with anyone else. |
| 26 // | 30 // |
| 27 // The |view_token| is used as a transferable reference which can | 31 // The |view_token| is used as a transferable reference which can |
| 28 // be passed to the view's intended container as part of a request to | 32 // be passed to the view's intended container as part of a request to |
| 29 // add the view as a child. The view manager itself does not describe | 33 // add the view as a child. The view manager itself does not describe |
| 30 // how this interaction should take place, only that the token should | 34 // how this interaction should take place, only that the token should |
| 31 // eventually be passed back through the container's view host interface | 35 // eventually be passed back through the container's view host interface |
| 32 // as an argument to AddChild(). | 36 // as an argument to AddChild(). |
| 33 // | 37 // |
| 38 // The |label| is an optional name to associate with the view for |
| 39 // diagnostic purposes. The label will be truncated if it is longer |
| 40 // than |kLabelMaxLength|. |
| 41 // |
| 34 // To unregister the view and cause it to be removed from the view tree, | 42 // To unregister the view and cause it to be removed from the view tree, |
| 35 // simply close the |view| and/or |view_host| message pipes. | 43 // simply close the |view| and/or |view_host| message pipes. |
| 36 RegisterView(mojo.ui.View view, | 44 RegisterView(mojo.ui.View view, |
| 37 mojo.ui.ViewHost& view_host) => | 45 mojo.ui.ViewHost& view_host, |
| 38 (mojo.ui.ViewToken view_token); | 46 string? label) => (mojo.ui.ViewToken view_token); |
| 39 | 47 |
| 40 // Registers a view tree with the view manager. | 48 // Registers a view tree with the view manager. |
| 41 // | 49 // |
| 42 // The |view_tree_host| is used to configure the view tree and interact | 50 // The |view_tree_host| is used to configure the view tree and interact |
| 43 // with the views it contains. The view tree host is private to the view | 51 // with the views it contains. The view tree host is private to the view |
| 44 // and should not be shared with anyone else. | 52 // and should not be shared with anyone else. |
| 45 // | 53 // |
| 54 // The |label| is an optional name to associate with the view tree for |
| 55 // diagnostic purposes. The label will be truncated if it is longer |
| 56 // than |kLabelMaxLength|. |
| 57 // |
| 58 // The |view_tree_token| is used as a transferable reference which can |
| 59 // be passed to trusted services to reference the view tree. |
| 60 // |
| 46 // To unregister the view tree simply close the |view_tree| and/or | 61 // To unregister the view tree simply close the |view_tree| and/or |
| 47 // |view_tree_host| message pipes. | 62 // |view_tree_host| message pipes. |
| 48 RegisterViewTree(mojo.ui.ViewTree view_tree, | 63 RegisterViewTree(mojo.ui.ViewTree view_tree, |
| 49 mojo.ui.ViewTreeHost& view_tree_host) => (); | 64 mojo.ui.ViewTreeHost& view_tree_host, |
| 65 string? label) => (mojo.ui.ViewTreeToken view_tree_token); |
| 50 }; | 66 }; |
| OLD | NEW |