blob: b55eafed765232fc61b9111ab63f5ac27390594a [file] [log] [blame]
// Copyright 2017 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;
/// Information about a Module instance in a story.
struct ModuleData {
/// The URL of the Module binary.
string module_url;
/// The named path leading up to this Module instance. The last name in this
/// array is the name by which the Module was started by the parent Module
/// instance calling StartModule().
vector<string> module_path;
/// Contains the mapping of Mod parameter name to Link instances for this mod.
ModuleParameterMap parameter_map;
/// The way in which this Module instance was first started in the story,
/// either by request from another Module instance (INTERNAL) or by request
/// from outside the story (i.e. by suggestion from an agent - EXTERNAL).
ModuleSource module_source;
/// The |surface_relation| that was used to start this Module instance with.
/// The same is used when re-inflating the Module instance when the story is
/// resumed. A SurfaceRelation value of null represents an embedded Module
/// instance (started by EmbedModule()) that is not managed by the story shell.
SurfaceRelation? surface_relation;
/// True if this module was removed from its story either through
/// ModuleController.Stop() or ModuleContext.RemoveSelfFromStory().
bool module_deleted;
/// The intent that was issued to start add this Module instance to the story.
/// Some Module instances may have been added not by an Intent, for example as
/// the initial module of a story. For those the field may be null.
///
/// TODO(thatguy,mesch): This field should now always be set, so make it
/// required once the framework is cleaned up enough to guarantee this
/// statement.
Intent? intent;
/// If true, this module was started by a parent module using
/// ModuleContext.EmbedModule(), and its view is not managed by the
/// StoryShell.
bool is_embedded = false;
};
enum ModuleSource {
/// Module that was added to the story from within the story by another
/// module using ModuleContext.AddModuleToStory() or
/// ModuleContext.EmbedModule().
INTERNAL = 0;
/// Module that was added to the story from outside the story using
/// PuppetMaster.
EXTERNAL = 1;
};
struct ModuleParameterMap {
vector<ModuleParameterMapEntry> entries;
};
struct ModuleParameterMapEntry {
/// A null [name] is allowed for backwards compatibility with default links.
/// TODO(thatguy); When no modules use null link names any more, make this
/// required.
string? name;
LinkPath link_path;
};