| // Copyright 2018 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.mem; |
| |
| // StoryCommands are POD structures that describe the set of operations that |
| // can be performed on a story by components outside the modular framework. All commands are: |
| // |
| // (1) Scoped to a single story |
| // (2) Idempotent: issuing the same command twice yields the same result |
| // (3) Symmetrical with observation: the same structures are used to describe |
| // operations to watchers of a story (through SessionWatcher) as are used |
| // to control a story. |
| union StoryCommand { |
| // Sets the focus state of the story to |set_focus_state.focused|. |
| SetFocusState set_focus_state; |
| |
| // Adds a Mod. |
| AddMod add_mod; |
| |
| // Updates mod link params. |
| UpdateMod update_mod; |
| |
| // Removes an existing Mod. |
| RemoveMod remove_mod; |
| |
| // Sets the value of a Link. |
| SetLinkValue set_link_value; |
| |
| // Brings focus to a mod. |
| FocusMod focus_mod; |
| |
| // Updates the kind_of_proto_story option in a story. |
| SetKindOfProtoStoryOption set_kind_of_proto_story_option; |
| }; |
| |
| struct SetFocusState { |
| bool focused; |
| }; |
| |
| // Adds a mod described by |intent| to the story with name |mod_name|. If |
| // |mod_name| already exists in the story, the mod is updated. |
| struct AddMod { |
| // The name of the mod within the story. The mod's name acts as the unique |
| // ID of the mod, scoped to the story in which it is contained. Since |
| // AddMod is reused for observation and mod names are vector<string> |
| // inside the framework, they are vector<string> here as well. |
| // |
| // Clients should treat the full vector as a single opaque value. |
| vector<string> mod_name; |
| Intent intent; |
| |
| // |surface_relation| defines the visual relationship between this mod and the |
| // mod at |surface_parent_mod_name|. |
| SurfaceRelation surface_relation; |
| vector<string>? surface_parent_mod_name; |
| }; |
| |
| // Updates a mod link values through its parameters. |
| struct UpdateMod { |
| vector<string> mod_name; |
| |
| // For every entry |p| in |parameters|, update the value of the link |
| // backing |p.name| to that specified in |p.data|. |
| vector<IntentParameter> parameters; |
| }; |
| |
| // Removes the mod under |mod_name| from the story. |
| struct RemoveMod { |
| vector<string> mod_name; |
| }; |
| |
| // Sets the value of link at |path| to |value|. |
| struct SetLinkValue { |
| LinkPath path; |
| fuchsia.mem.Buffer? value; |
| }; |
| |
| // Instructs the session shell to focus the mod under |mod_name|. |
| struct FocusMod { |
| vector<string> mod_name; |
| }; |
| |
| // Updates the kind_of_proto_story option in a story. |
| struct SetKindOfProtoStoryOption { |
| bool value; |
| }; |