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/services/ui/views/interfaces/layouts.mojom"; | 9 import "mojo/services/ui/views/interfaces/layouts.mojom"; |
9 import "mojo/services/ui/views/interfaces/views.mojom"; | 10 import "mojo/services/ui/views/interfaces/views.mojom"; |
10 | 11 |
| 12 // A view tree token is an opaque transferable reference to a view tree. |
| 13 // |
| 14 // The ViewManager provides each view tree with a unique view tree token when |
| 15 // it is registered. The token can subsequently be passed to other |
| 16 // applications and used as a way to refer to the tree. |
| 17 // |
| 18 // View tree tokens should be kept secret and should only be shared with |
| 19 // trusted services. |
| 20 // |
| 21 // TODO(jeffbrown): This implementation is a temporary placeholder until |
| 22 // we extend Mojo to provide a way to create tokens which cannot be forged. |
| 23 struct ViewTreeToken { |
| 24 uint32 value; |
| 25 }; |
| 26 |
11 // A view tree is a top-level container for a hierarchy of views. | 27 // A view tree is a top-level container for a hierarchy of views. |
12 // | 28 // |
13 // A view tree must registered with the view manager before it can be shown. | 29 // A view tree must registered with the view manager before it can be shown. |
14 interface ViewTree { | 30 interface ViewTree { |
15 // Called when the tree needs to update its layout. | 31 // Called when the tree needs to update its layout. |
16 // | 32 // |
17 // This method may be called for one or more of the following reasons: | 33 // This method may be called for one or more of the following reasons: |
18 // | 34 // |
19 // 1. The root was just set. | 35 // 1. The root was just set. |
20 // 2. The root produced different layout information during its last | 36 // 2. The root produced different layout information during its last |
(...skipping 18 matching lines...) Expand all Loading... |
39 OnRootUnavailable(uint32 root_key) => (); | 55 OnRootUnavailable(uint32 root_key) => (); |
40 }; | 56 }; |
41 | 57 |
42 // 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 |
43 // and interact with its views. | 59 // and interact with its views. |
44 // | 60 // |
45 // 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 |
46 // ViewManager. To unregister the view tree, close its view tree | 62 // ViewManager. To unregister the view tree, close its view tree |
47 // and/or view tree host message pipes. | 63 // and/or view tree host message pipes. |
48 interface ViewTreeHost { | 64 interface ViewTreeHost { |
| 65 // Gets a service provider to access services which are associated with |
| 66 // the view tree such as input, accessibility and editing capabilities. |
| 67 // The view tree service provider is private to the view tree and should |
| 68 // not be shared with anyone else. |
| 69 // |
| 70 // See |mojo.ui.InputDispatcher|. |
| 71 GetServiceProvider(mojo.ServiceProvider& service_provider); |
| 72 |
49 // Requests that the view tree's OnLayout() method be called to compute a | 73 // 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. | 74 // new layout due to a change in the view tree's layout information. |
51 RequestLayout(); | 75 RequestLayout(); |
52 | 76 |
53 // Sets the root of the view tree and assigns it the provided |root_key| | 77 // 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. | 78 // to distinguish it from any other roots this view tree has had. |
55 // | 79 // |
56 // It is a good idea to provide a distinct |root_key| each time a new root | 80 // 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 | 81 // is set so that callbacks related to the root can be clearly distinguished |
58 // across these changes. | 82 // across these changes. |
(...skipping 24 matching lines...) Expand all Loading... |
83 // or because the root has become unavailable. | 107 // or because the root has become unavailable. |
84 // | 108 // |
85 // It is an error to call this function if the view tree does not currently | 109 // It is an error to call this function if the view tree does not currently |
86 // have a root; the connection will be closed. | 110 // have a root; the connection will be closed. |
87 // | 111 // |
88 // It is an error to specify malformed |root_layout_params| such | 112 // It is an error to specify malformed |root_layout_params| such |
89 // as invalid size constraints; the connection will be closed. | 113 // as invalid size constraints; the connection will be closed. |
90 LayoutRoot(mojo.ui.ViewLayoutParams root_layout_params) => | 114 LayoutRoot(mojo.ui.ViewLayoutParams root_layout_params) => |
91 (mojo.ui.ViewLayoutInfo? info); | 115 (mojo.ui.ViewLayoutInfo? info); |
92 }; | 116 }; |
OLD | NEW |