| // Copyright 2016 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| library fuchsia.modular; |
| |
| using fuchsia.ui.views; |
| |
| /// This interface is exposed to all Module instances in a story. It allows to |
| /// create Link instances and run more Module instances. |
| [Discoverable] |
| protocol ModuleContext { |
| /// Starts a new Module instance and adds it to the story. The Module to |
| /// execute is identified by the contents of [intent] and the Module instance |
| /// is given a [name] in the scope of the starting Module instance. The view |
| /// for the Module is given to the story shell for display. |
| /// |
| /// Providing a [surface_relation] advises the StoryShell how to layout |
| /// surfaces that the new module creates. If [surface_relation] is null then |
| /// a default relation is used. |
| /// |
| /// If the method is called again with the same [name] by the same Module |
| /// instance, but with different arguments, the existing Module instance is |
| /// restarted with the changed arguments. If the other arguments don't |
| /// change, just an additional ModuleController connection is made. |
| AddModuleToStory(string name, Intent intent, |
| request<ModuleController> module_controller, |
| SurfaceRelation? surface_relation) |
| -> (StartModuleStatus status); |
| |
| /// Like AddModuleToStory(), but passes a [view_token] explicitly to embed |
| /// the view of the requested Module instance in the view of the requesting |
| /// Module instance, instead of relying on the story shell for display. If a |
| /// Module instance with the same [name] and [intent] is already running, |
| /// [view_token] is destroyed. |
| [Transitional] |
| EmbedModule(string name, Intent intent, |
| request<ModuleController> module_controller, |
| fuchsia.ui.views.ViewToken view_token) |
| -> (StartModuleStatus status); |
| |
| /// When a module calls [RemoveSelfFromStory()] the framework will stop the |
| /// module and remove it from the story. If there are no more running modules |
| /// in the story the story will be deleted. |
| RemoveSelfFromStory(); |
| }; |
| |
| /// Communicates the status of an Intent to a Module. |
| enum StartModuleStatus { |
| SUCCESS = 0; |
| NO_MODULES_FOUND = 1; |
| }; |
| |
| /// This interface defines the protocol over which a Module can communicate about |
| /// an ongoing activity to the framework. It is provided to Modules via |
| /// ModuleContext.StartOngoingActivity(). |
| protocol OngoingActivity { |
| }; |
| |
| enum OngoingActivityType { |
| UNSPECIFIED = 0; |
| VIDEO = 1; |
| AUDIO = 2; |
| }; |