blob: 49a30c32ab54c1397044a7338757b8a778955aa9 [file] [log] [blame]
// 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;
/// Used by the clients of StoryProvider (SessionShell) to interact with a single
/// story. Created by StoryProvider.
///
/// If `StoryController` is closed, the `StoryState` associated with this story
/// does not change.
protocol StoryController {
/// Gets information associated with the story.
[Transitional = "Use GetInfo2 instead"]
GetInfo() -> (StoryInfo info, StoryState state);
/// For transition purposes only.
[Transitional = "Only use while GetInfo2 is transitional"]
GetInfo2() -> (StoryInfo2 info, StoryState state);
/// Requests to run the story controlled by this `StoryController` instance.
/// When the story starts, if not yet running, the view of the newly started
/// story shell will be passed in a call to SessionShell.AttachView().
RequestStart();
/// Requests to stop the story controlled by this `StoryController`. If Start()
/// requests are pending when this request is issued, the request is queued
/// until the Start() requests complete. Before stopping the story, a snapshot
/// of the story will be taken and saved. Returns when the story is stopped.
Stop() -> ();
/// Registers a watcher for changes of the story state.
///
/// Note that stories can stop themselves at any time and it is advisable
/// for the holder of a StoryController to provide a watcher.
Watch(StoryWatcher watcher);
/// Attach the `annotations` to the story.
///
/// Existing annotations with the same key will be overwritten.
Annotate(vector<Annotation>:MAX_ANNOTATIONS_PER_UPDATE annotations)
-> () error AnnotationError;
};
/// Implemented by the client calling StoryController.Watch().
protocol StoryWatcher {
/// Called with the current state right after registration, and subsequently
/// when the state changes.
OnStateChange(StoryState new_state);
/// DEPRECATED
OnModuleAdded(ModuleData module_data);
/// DEPRECATED
OnModuleFocused(vector<string> module_path);
};