| 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/scene_token.mojom"; | 9 import "mojo/services/gfx/composition/interfaces/scene_token.mojom"; |
| 10 import "mojo/services/ui/views/interfaces/view_trees.mojom"; |
| 10 import "mojo/services/ui/views/interfaces/views.mojom"; | 11 import "mojo/services/ui/views/interfaces/views.mojom"; |
| 11 import "mojo/services/ui/views/interfaces/view_trees.mojom"; | |
| 12 | 12 |
| 13 // View associates are trusted components that are attached to a view manager | 13 // View associates are trusted components that are attached to a view manager |
| 14 // instance with the purpose of offering additional services to views and | 14 // instance with the purpose of offering additional services to views and |
| 15 // view trees registered beyond the basic operations performed by the | 15 // view trees registered beyond the basic operations performed by the |
| 16 // view manager itself. Associates may be used to implement input, | 16 // view manager itself. Associates may be used to implement input, |
| 17 // accessibility, editing, and other capabilities. | 17 // accessibility, editing, and other capabilities. |
| 18 // | 18 // |
| 19 // Associates are coupled to a view manager instance for the entire life | 19 // Associates are coupled to a view manager instance for the entire life |
| 20 // of that view manager. Associates cannot be dynamically added or removed | 20 // of that view manager. Associates cannot be dynamically added or removed |
| 21 // since applications rely on the services that they offer and expect them | 21 // since applications rely on the services that they offer and expect them |
| (...skipping 19 matching lines...) Expand all Loading... |
| 41 // The associate must return information about the services that it | 41 // The associate must return information about the services that it |
| 42 // offers in |info|. | 42 // offers in |info|. |
| 43 Connect(ViewInspector inspector) => (ViewAssociateInfo info); | 43 Connect(ViewInspector inspector) => (ViewAssociateInfo info); |
| 44 | 44 |
| 45 // Asks the associate to provide the view service identified by | 45 // Asks the associate to provide the view service identified by |
| 46 // |interface_name| through the message |pipe| endpoint supplied by | 46 // |interface_name| through the message |pipe| endpoint supplied by |
| 47 // the caller. If the associate is not willing or able to provide the | 47 // the caller. If the associate is not willing or able to provide the |
| 48 // requested service, it should close the |pipe|. | 48 // requested service, it should close the |pipe|. |
| 49 // | 49 // |
| 50 // The |view_token| is the token of the view which requested the service. | 50 // The |view_token| is the token of the view which requested the service. |
| 51 ConnectToViewService(ViewToken view_token, string service_name, | 51 ConnectToViewService(ViewToken view_token, |
| 52 handle<message_pipe> pipe); | 52 string service_name, |
| 53 handle<message_pipe> pipe); |
| 53 | 54 |
| 54 // Asks the associate to provide the view tree service identified by | 55 // Asks the associate to provide the view tree service identified by |
| 55 // |interface_name| through the message |pipe| endpoint supplied by | 56 // |interface_name| through the message |pipe| endpoint supplied by |
| 56 // the caller. If the associate is not willing or able to provide the | 57 // the caller. If the associate is not willing or able to provide the |
| 57 // requested service, it should close the |pipe|. | 58 // requested service, it should close the |pipe|. |
| 58 // | 59 // |
| 59 // The |view_tree_token| is the token of the view tree which requested | 60 // The |view_tree_token| is the token of the view tree which requested |
| 60 // the service. | 61 // the service. |
| 61 ConnectToViewTreeService(ViewTreeToken view_tree_token, | 62 ConnectToViewTreeService(ViewTreeToken view_tree_token, |
| 62 string service_name, handle<message_pipe> pipe); | 63 string service_name, |
| 64 handle<message_pipe> pipe); |
| 63 }; | 65 }; |
| 64 | 66 |
| 65 // Provides information about the services offered by an associate. | 67 // Provides information about the services offered by an associate. |
| 66 struct ViewAssociateInfo { | 68 struct ViewAssociateInfo { |
| 67 // The names of view services offered by the associate. | 69 // The names of view services offered by the associate. |
| 68 // May be null if none. | 70 // May be null if none. |
| 69 array<string>? view_service_names; | 71 array<string>? view_service_names; |
| 70 | 72 |
| 71 // The names of view tree services offered by the associate. | 73 // The names of view tree services offered by the associate. |
| 72 // May be null if none. | 74 // May be null if none. |
| 73 array<string>? view_tree_service_names; | 75 array<string>? view_tree_service_names; |
| 74 }; | 76 }; |
| 75 | 77 |
| 76 // Provides a view associate with the ability to inspect and perform operations | 78 // Provides a view associate with the ability to inspect and perform operations |
| 77 // on the contents of views and view trees. | 79 // on the contents of views and view trees. |
| 78 interface ViewInspector { | 80 interface ViewInspector { |
| 79 // Provides an interface which can be used to perform hit tests on the | 81 // Provides an interface which can be used to perform hit tests on the |
| 80 // contents of the view tree's scene graph. | 82 // contents of the view tree's scene graph. |
| 81 // | 83 // |
| 82 // The |hit_tester| will be closed if the view tree is not attached to a | 84 // The |hit_tester| will be closed if the view tree is not attached to a |
| 83 // renderer, when it is reattached to a different renderer, or when the | 85 // renderer, when it is reattached to a different renderer, or when the |
| 84 // view tree is destroyed. | 86 // view tree is destroyed. |
| 85 // | 87 // |
| 86 // The callback will be invoked the hit tester is invalidated. | 88 // The callback will be invoked the hit tester is invalidated. |
| 87 // If |renderer_changed| is true, the client should call |GetHitTester| | 89 // If |renderer_changed| is true, the client should call |GetHitTester| |
| 88 // again to obtain a new one. Otherwise it should assume that the view | 90 // again to obtain a new one. Otherwise it should assume that the view |
| 89 // tree has become unavailable (so no hit tester is available). | 91 // tree has become unavailable (so no hit tester is available). |
| 90 GetHitTester(ViewTreeToken view_tree_token, | 92 GetHitTester(ViewTreeToken view_tree_token, |
| 91 mojo.gfx.composition.HitTester& hit_tester) => | 93 mojo.gfx.composition.HitTester& hit_tester) |
| 92 (bool renderer_changed); | 94 => (bool renderer_changed); |
| 93 | 95 |
| 94 // Given an array of scene tokens, produces an array of view tokens | 96 // Given an array of scene tokens, produces an array of view tokens |
| 95 // of equal size containing the view to which the scene belongs or null | 97 // of equal size containing the view to which the scene belongs or null |
| 96 // if the scene token does not belong to any view. | 98 // if the scene token does not belong to any view. |
| 97 // | 99 // |
| 98 // It is safe to cache the results of this operation because a scene will | 100 // It is safe to cache the results of this operation because a scene will |
| 99 // only ever be associated with at most one view although a view may | 101 // only ever be associated with at most one view although a view may |
| 100 // create several scenes during its lifetime. | 102 // create several scenes during its lifetime. |
| 101 ResolveScenes(array<mojo.gfx.composition.SceneToken> scene_tokens) => | 103 ResolveScenes(array<mojo.gfx.composition.SceneToken> scene_tokens) |
| 102 (array<ViewToken?> view_tokens); | 104 => (array<ViewToken?> view_tokens); |
| 103 }; | 105 }; |
| OLD | NEW |