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/gfx/composition/interfaces/hit_tests.mojom"; | 9 import "mojo/services/gfx/composition/interfaces/hit_tests.mojom"; |
10 import "mojo/services/gfx/composition/interfaces/scene_token.mojom"; | 10 import "mojo/services/gfx/composition/interfaces/scene_token.mojom"; |
11 import "mojo/services/ui/views/interfaces/view_token.mojom"; | 11 import "mojo/services/ui/views/interfaces/view_token.mojom"; |
12 import "mojo/services/ui/views/interfaces/view_tree_token.mojom"; | 12 import "mojo/services/ui/views/interfaces/view_tree_token.mojom"; |
13 | 13 |
14 // View associates are trusted components that are attached to a view manager | 14 // View associates are trusted components that are attached to a view manager |
15 // instance with the purpose of offering additional services to views and | 15 // instance with the purpose of offering additional services to views and |
16 // view trees registered beyond the basic operations performed by the | 16 // view trees registered beyond the basic operations performed by the |
17 // view manager itself. Associates may be used to implement input, | 17 // view manager itself. Associates may be used to implement input, |
18 // accessibility, editing, and other capabilities. | 18 // accessibility, editing, and other capabilities. |
19 // | 19 // |
20 // Associates are coupled to a view manager instance for the entire life | 20 // Associates are coupled to a view manager instance for the entire life |
21 // of that view manager. Associates cannot be dynamically added or removed | 21 // of that view manager. Associates cannot be dynamically added or removed |
22 // since applications rely on the services that they offer and expect them | 22 // since applications rely on the services that they offer and expect them |
23 // to be available for the lifetime of their views. Moreover, all views and | 23 // to be available for the lifetime of their views. Moreover, all views and |
24 // view trees registered with a particular view manager instance share | 24 // view trees registered with a particular view manager instance share |
25 // the same set of associates. | 25 // the same set of associates. |
26 // | 26 // |
27 // This mechanism is designed to avoid a potential explosion in complexity | 27 // This mechanism is designed to avoid a potential explosion in complexity |
28 // if all features which depend on the state of views were implemented | 28 // if all features which depend on the state of views were implemented |
29 // in one place. | 29 // in one place. |
30 // | |
31 // TODO(jeffbrown): In the current implementation, the view manager binds | |
32 // to a hard coded set of associates at start up time which can be overridden | |
33 // from the command-line. We should find a better way to register associates | |
34 // once we decide how the system as a whole should be initialized. | |
35 [ServiceName="mojo::ui::ViewAssociate"] | 30 [ServiceName="mojo::ui::ViewAssociate"] |
36 interface ViewAssociate { | 31 interface ViewAssociate { |
37 // Connects to the associate. | 32 // Connects to the associate. |
38 // | 33 // |
39 // The |inspector| provides a means for the view associate to query state | 34 // The |inspector| provides a means for the view associate to query state |
40 // from the view manager. | 35 // from the view manager. |
41 // | 36 // |
42 // The associate must return information about the services that it | 37 // The associate must return information about the services that it |
43 // offers in |info|. | 38 // offers in |info|. |
44 Connect(ViewInspector inspector) => (ViewAssociateInfo info); | 39 Connect(ViewInspector inspector) => (ViewAssociateInfo info); |
(...skipping 13 matching lines...) Expand all Loading... |
58 // the caller. If the associate is not willing or able to provide the | 53 // the caller. If the associate is not willing or able to provide the |
59 // requested service, it should close the |pipe|. | 54 // requested service, it should close the |pipe|. |
60 // | 55 // |
61 // The |view_tree_token| is the token of the view tree which requested | 56 // The |view_tree_token| is the token of the view tree which requested |
62 // the service. | 57 // the service. |
63 ConnectToViewTreeService(ViewTreeToken view_tree_token, | 58 ConnectToViewTreeService(ViewTreeToken view_tree_token, |
64 string service_name, | 59 string service_name, |
65 handle<message_pipe> pipe); | 60 handle<message_pipe> pipe); |
66 }; | 61 }; |
67 | 62 |
| 63 // ViewAssociateOwner is used as a transferable reference which can |
| 64 // be passed to a ViewAssociate's intended container as part of a request to |
| 65 // register the ViewAssociate with the ViewManager. The ViewAssociateOwner will |
| 66 // get a connection error callback if the corresponding ViewAssociate is |
| 67 // destroyed, and similarly the ViewAssociate that it owns will be killed if |
| 68 // this object is destroyed. |
| 69 [ServiceName="mojo::ui::ViewAssociateOwner"] |
| 70 interface ViewAssociateOwner {}; |
| 71 |
68 // Provides information about the services offered by an associate. | 72 // Provides information about the services offered by an associate. |
69 struct ViewAssociateInfo { | 73 struct ViewAssociateInfo { |
70 // The names of view services offered by the associate. | 74 // The names of view services offered by the associate. |
71 // May be null if none. | 75 // May be null if none. |
72 array<string>? view_service_names; | 76 array<string>? view_service_names; |
73 | 77 |
74 // The names of view tree services offered by the associate. | 78 // The names of view tree services offered by the associate. |
75 // May be null if none. | 79 // May be null if none. |
76 array<string>? view_tree_service_names; | 80 array<string>? view_tree_service_names; |
77 }; | 81 }; |
(...skipping 19 matching lines...) Expand all Loading... |
97 // Given an array of scene tokens, produces an array of view tokens | 101 // Given an array of scene tokens, produces an array of view tokens |
98 // of equal size containing the view to which the scene belongs or null | 102 // of equal size containing the view to which the scene belongs or null |
99 // if the scene token does not belong to any view. | 103 // if the scene token does not belong to any view. |
100 // | 104 // |
101 // It is safe to cache the results of this operation because a scene will | 105 // It is safe to cache the results of this operation because a scene will |
102 // only ever be associated with at most one view although a view may | 106 // only ever be associated with at most one view although a view may |
103 // create several scenes during its lifetime. | 107 // create several scenes during its lifetime. |
104 ResolveScenes(array<mojo.gfx.composition.SceneToken> scene_tokens) | 108 ResolveScenes(array<mojo.gfx.composition.SceneToken> scene_tokens) |
105 => (array<ViewToken?> view_tokens); | 109 => (array<ViewToken?> view_tokens); |
106 }; | 110 }; |
OLD | NEW |