1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
7 import "presentation_session.mojom";
9 struct PresentationSessionInfo {
10 PresentationSession session;
15 enum PresentationErrorType {
17 SESSION_REQUEST_CANCELLED,
18 NO_PRESENTATION_FOUND,
22 struct PresentationError {
23 PresentationErrorType errorType;
27 interface PresentationService {
28 // Returns the last screen availability state if it’s changed since the last
29 // time the method was called. The client has to call this method again when
30 // handling the result (provided via Mojo callback) to get the next update
31 // about the availability status.
32 // May start discovery of the presentation screens. The implementation might
33 // stop discovery once there are no active calls to GetScreenAvailability.
34 // |presentation_url| can be specified to help the implementation to filter
35 // out incompatible screens.
36 GetScreenAvailability(string? presentation_url) => (bool available);
38 // Called when the frame no longer listens to the
39 // |availablechange| event.
40 OnScreenAvailabilityListenerRemoved();
42 // Called when startSession() is called by the frame. The result callback
43 // will return a non-null and valid PresentationSessionInfo if starting the
44 // session succeeded, or null with a PresentationError if starting the
46 // The presentation id is always returned along with the initialized
47 // session on success.
48 // If the UA identifies a matching session (same presentation url and id),
49 // the user may choose this existing session and the page will join it
50 // rather than get a new one. An empty presentation id means that the
51 // UA will generate the presentation id.
52 StartSession(string presentation_url, string? presentation_id)
53 => (PresentationSessionInfo? sessionInfo, PresentationError? error);
55 // Called when joinSession() is called by the frame. The result callback
56 // works the same as for the method above. JoinSession will join a known
57 // session (i.e. when the page navigates or the user opens another tab)
58 // silently and without user action.
59 JoinSession(string presentation_url, string? presentation_id)
60 => (PresentationSessionInfo? sessionInfo, PresentationError? error);