| 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/public/interfaces/application/service_provider.mojom"; | 8 import "mojo/public/interfaces/application/service_provider.mojom"; |
| 9 import "mojo/services/ui/views/interfaces/layouts.mojom"; | 9 import "mojo/services/ui/views/interfaces/layouts.mojom"; |
| 10 import "mojo/services/ui/views/interfaces/views.mojom"; | 10 import "mojo/services/ui/views/interfaces/views.mojom"; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 OnRootUnavailable(uint32 root_key) => (); | 55 OnRootUnavailable(uint32 root_key) => (); |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 // The view tree host provides an interface for a view tree to configure itself | 58 // The view tree host provides an interface for a view tree to configure itself |
| 59 // and interact with its views. | 59 // and interact with its views. |
| 60 // | 60 // |
| 61 // Each view tree obtains its own view tree host when registered with the | 61 // Each view tree obtains its own view tree host when registered with the |
| 62 // ViewManager. To unregister the view tree, close its view tree | 62 // ViewManager. To unregister the view tree, close its view tree |
| 63 // and/or view tree host message pipes. | 63 // and/or view tree host message pipes. |
| 64 interface ViewTreeHost { | 64 interface ViewTreeHost { |
| 65 // Gets the view tree's token. |
| 66 GetToken() => (ViewTreeToken token); |
| 67 |
| 65 // Gets a service provider to access services which are associated with | 68 // Gets a service provider to access services which are associated with |
| 66 // the view tree such as input, accessibility and editing capabilities. | 69 // the view tree such as input, accessibility and editing capabilities. |
| 67 // The view tree service provider is private to the view tree and should | 70 // The view tree service provider is private to the view tree and should |
| 68 // not be shared with anyone else. | 71 // not be shared with anyone else. |
| 69 // | 72 // |
| 70 // See |mojo.ui.InputDispatcher|. | 73 // See |mojo.ui.InputDispatcher|. |
| 71 GetServiceProvider(mojo.ServiceProvider& service_provider); | 74 GetServiceProvider(mojo.ServiceProvider& service_provider); |
| 72 | 75 |
| 73 // Requests that the view tree's OnLayout() method be called to compute a | 76 // Requests that the view tree's OnLayout() method be called to compute a |
| 74 // new layout due to a change in the view tree's layout information. | 77 // new layout due to a change in the view tree's layout information. |
| 75 RequestLayout(); | 78 RequestLayout(); |
| 76 | 79 |
| 77 // Sets the root of the view tree and assigns it the provided |root_key| | 80 // Sets the root of the view tree and assigns it the provided |root_key| |
| 78 // to distinguish it from any other roots this view tree has had. | 81 // to distinguish it from any other roots this view tree has had. |
| 79 // | 82 // |
| 80 // It is a good idea to provide a distinct |root_key| each time a new root | 83 // It is a good idea to provide a distinct |root_key| each time a new root |
| 81 // is set so that callbacks related to the root can be clearly distinguished | 84 // is set so that callbacks related to the root can be clearly distinguished |
| 82 // across these changes. | 85 // across these changes. |
| 83 // | 86 // |
| 84 // If |root_view_token| refers to a view which is already unavailable | 87 // If |root_view_owner| refers to a view which is already unavailable |
| 85 // then the call proceeds as if it succeeded but an OnChildUnavailable() | 88 // then the call proceeds as if it succeeded but an OnChildUnavailable() |
| 86 // message will be sent. | 89 // message will be sent. |
| 87 // | 90 // |
| 88 // If |root_view_token| refers to a view which already has a parent or is | 91 // If |root_view_owner| refers to a view which already has a parent or is |
| 89 // the root of a view tree then an OnChildUnavailable() or OnRootUnavailable() | 92 // the root of a view tree then an OnChildUnavailable() or OnRootUnavailable() |
| 90 // message will be sent to its old parent or root and the the view will be | 93 // message will be sent to its old parent or root and the the view will be |
| 91 // used as the root of the new view tree as usual. This special case also | 94 // used as the root of the new view tree as usual. This special case also |
| 92 // applies when the specified view is already the root of this view tree, in | 95 // applies when the specified view is already the root of this view tree, in |
| 93 // which case the behavior is similar to the view having been transferred to | 96 // which case the behavior is similar to the view having been transferred to |
| 94 // some other view tree and then back again. | 97 // some other view tree and then back again. |
| 95 SetRoot(uint32 root_key, mojo.ui.ViewToken root_view_token); | 98 // |
| 99 // It is an error to call this function if the root has already been set; |
| 100 // the connection will be closed. |
| 101 SetRoot(uint32 root_key, mojo.ui.ViewOwner root_view_owner); |
| 96 | 102 |
| 97 // Removes the root of the view tree. | 103 // Removes the root of the view tree. |
| 98 // | 104 // |
| 99 // Does nothing if the view tree currently does not have a root. | 105 // If |transferred_view_owner| is not null, associates it with the previously |
| 100 ResetRoot(); | 106 // configured view or closes the |transferred_view_owner| message pipe |
| 107 // if there was none. |
| 108 // |
| 109 // It is an error to call this function if the root was not previously set; |
| 110 // the connection will be closed. |
| 111 ResetRoot(mojo.ui.ViewOwner&? transferred_view_owner); |
| 101 | 112 |
| 102 // Sets the layout parameters of the root of the view tree and retrieves | 113 // Sets the layout parameters of the root of the view tree and retrieves |
| 103 // its layout information. | 114 // its layout information. |
| 104 // | 115 // |
| 105 // The returned |info| is null if this layout request was canceled either | 116 // The returned |info| is null if this layout request was canceled either |
| 106 // because it has been superceded by a subsequently issued layout request | 117 // because it has been superceded by a subsequently issued layout request |
| 107 // or because the root has become unavailable. | 118 // or because the root has become unavailable. |
| 108 // | 119 // |
| 109 // It is an error to call this function if the view tree does not currently | 120 // It is an error to call this function if the view tree does not currently |
| 110 // have a root; the connection will be closed. | 121 // have a root; the connection will be closed. |
| 111 // | 122 // |
| 112 // It is an error to specify malformed |root_layout_params| such | 123 // It is an error to specify malformed |root_layout_params| such |
| 113 // as invalid size constraints; the connection will be closed. | 124 // as invalid size constraints; the connection will be closed. |
| 114 LayoutRoot(mojo.ui.ViewLayoutParams root_layout_params) => | 125 LayoutRoot(mojo.ui.ViewLayoutParams root_layout_params) => |
| 115 (mojo.ui.ViewLayoutInfo? info); | 126 (mojo.ui.ViewLayoutInfo? info); |
| 116 }; | 127 }; |
| OLD | NEW |