blob: b4057ff1b9cafa163eb7d0d007e2ea9084961eb0 [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.
closed protocol StoryController {
/// Gets information associated with the story.
strict GetInfo() -> (struct {
info StoryInfo;
state StoryState;
});
/// For transition purposes only.
strict GetInfo2() -> (resource struct {
info StoryInfo2;
state StoryState;
});
/// 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().
strict 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.
strict 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.
strict Watch(resource struct {
watcher client_end:StoryWatcher;
});
/// Attach the `annotations` to the story.
///
/// Existing annotations with the same key will be overwritten.
strict Annotate(resource struct {
annotations vector<Annotation>:MAX_ANNOTATIONS_PER_UPDATE;
}) -> () error AnnotationError;
};
/// Implemented by the client calling StoryController.Watch().
closed protocol StoryWatcher {
/// Called with the current state right after registration, and subsequently
/// when the state changes.
strict OnStateChange(struct {
new_state StoryState;
});
/// DEPRECATED
strict OnModuleAdded(resource struct {
module_data ModuleData;
});
/// DEPRECATED
strict OnModuleFocused(struct {
module_path vector<string:MAX>:MAX;
});
};