Chromium Code Reviews| 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 [ServiceName="mojo::ui::ViewAssociateOwner"] | |
|
jeffbrown
2016/05/18 18:07:16
Please add a comment explaining what this type rep
mikejurka
2016/05/18 19:09:10
Done.
| |
| 64 interface ViewAssociateOwner {}; | |
| 65 | |
| 68 // Provides information about the services offered by an associate. | 66 // Provides information about the services offered by an associate. |
| 69 struct ViewAssociateInfo { | 67 struct ViewAssociateInfo { |
| 70 // The names of view services offered by the associate. | 68 // The names of view services offered by the associate. |
| 71 // May be null if none. | 69 // May be null if none. |
| 72 array<string>? view_service_names; | 70 array<string>? view_service_names; |
| 73 | 71 |
| 74 // The names of view tree services offered by the associate. | 72 // The names of view tree services offered by the associate. |
| 75 // May be null if none. | 73 // May be null if none. |
| 76 array<string>? view_tree_service_names; | 74 array<string>? view_tree_service_names; |
| 77 }; | 75 }; |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 97 // Given an array of scene tokens, produces an array of view tokens | 95 // 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 | 96 // of equal size containing the view to which the scene belongs or null |
| 99 // if the scene token does not belong to any view. | 97 // if the scene token does not belong to any view. |
| 100 // | 98 // |
| 101 // It is safe to cache the results of this operation because a scene will | 99 // 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 | 100 // only ever be associated with at most one view although a view may |
| 103 // create several scenes during its lifetime. | 101 // create several scenes during its lifetime. |
| 104 ResolveScenes(array<mojo.gfx.composition.SceneToken> scene_tokens) | 102 ResolveScenes(array<mojo.gfx.composition.SceneToken> scene_tokens) |
| 105 => (array<ViewToken?> view_tokens); | 103 => (array<ViewToken?> view_tokens); |
| 106 }; | 104 }; |
| OLD | NEW |