OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 [DartPackage="mojo_services"] |
| 6 module mojo.ui; |
| 7 |
| 8 import "mojo/public/interfaces/application/service_provider.mojom"; |
| 9 import "mojo/services/ui/views/interfaces/views.mojom"; |
| 10 import "mojo/services/ui/views/interfaces/view_trees.mojom"; |
| 11 |
| 12 // View associates are trusted components that are attached to a view manager |
| 13 // instance with the purpose of offering additional services to views and |
| 14 // view trees registered beyond the basic operations performed by the |
| 15 // view manager itself. Associates may be used to implement input, |
| 16 // accessibility, editing, and other capabilities. |
| 17 // |
| 18 // Associates are coupled to a view manager instance for the entire life |
| 19 // of that view manager. Associates cannot be dynamically added or removed |
| 20 // since applications rely on the services that they offer and expect them |
| 21 // to be available for the lifetime of their views. Moreover, all views and |
| 22 // view trees registered with a particular view manager instance share |
| 23 // the same set of associates. |
| 24 // |
| 25 // This mechanism is designed to avoid a potential explosion in complexity |
| 26 // if all features which depend on the state of views were implemented |
| 27 // in one place. |
| 28 // |
| 29 // TODO(jeffbrown): In the current implementation, the view manager binds |
| 30 // to a hard coded set of associates at start up time which can be overridden |
| 31 // from the command-line. We should find a better way to register associates |
| 32 // once we decide how the system as a whole should be initialized. |
| 33 [ServiceName="mojo::ui::ViewAssociate"] |
| 34 interface ViewAssociate { |
| 35 // Connects to the associate. |
| 36 // |
| 37 // The |inspector| provides a means for the view associate to query state |
| 38 // from the view manager. |
| 39 // |
| 40 // The associate must return information about the services that it |
| 41 // offers in |info|. |
| 42 Connect(ViewInspector inspector) => (ViewAssociateInfo info); |
| 43 |
| 44 // Asks the associate to provide the view service identified by |
| 45 // |interface_name| through the message |pipe| endpoint supplied by |
| 46 // the caller. If the host is not willing or able to provide the requested |
| 47 // service, it should close the |pipe|. |
| 48 // |
| 49 // The |view_token| is the token of the view which requested the service. |
| 50 ConnectToViewService(ViewToken view_token, string service_name, |
| 51 handle<message_pipe> pipe); |
| 52 |
| 53 // Asks the associate to provide the view tree service identified by |
| 54 // |interface_name| through the message |pipe| endpoint supplied by |
| 55 // the caller. If the host is not willing or able to provide the requested |
| 56 // service, it should close the |pipe|. |
| 57 // |
| 58 // The |view_tree_token| is the token of the view tree which requested |
| 59 // the service. |
| 60 ConnectToViewTreeService(ViewTreeToken view_tree_token, |
| 61 string service_name, handle<message_pipe> pipe); |
| 62 }; |
| 63 |
| 64 // Provides information about the services offered by an associate. |
| 65 struct ViewAssociateInfo { |
| 66 // The names of view services offered by the associate. |
| 67 // May be null if none. |
| 68 array<string>? view_service_names; |
| 69 |
| 70 // The names of view tree services offered by the associate. |
| 71 // May be null if none. |
| 72 array<string>? view_tree_service_names; |
| 73 }; |
| 74 |
| 75 // Provides a view associate with the ability to inspect and perform operations |
| 76 // on the contents of views and view trees. |
| 77 interface ViewInspector { |
| 78 |
| 79 }; |
OLD | NEW |