| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 module presentation; | 5 module presentation; |
| 6 | 6 |
| 7 import "presentation_session.mojom"; | |
| 8 | |
| 9 struct PresentationSessionInfo { | 7 struct PresentationSessionInfo { |
| 10 PresentationSession session; | |
| 11 string url; | 8 string url; |
| 12 string id; | 9 string id; |
| 13 }; | 10 }; |
| 14 | 11 |
| 15 enum PresentationErrorType { | 12 enum PresentationErrorType { |
| 16 NO_AVAILABLE_SCREENS, | 13 NO_AVAILABLE_SCREENS, |
| 17 SESSION_REQUEST_CANCELLED, | 14 SESSION_REQUEST_CANCELLED, |
| 18 NO_PRESENTATION_FOUND, | 15 NO_PRESENTATION_FOUND, |
| 19 UNKNOWN, | 16 UNKNOWN, |
| 20 }; | 17 }; |
| 21 | 18 |
| 22 struct PresentationError { | 19 struct PresentationError { |
| 23 PresentationErrorType errorType; | 20 PresentationErrorType error_type; |
| 24 string message; | 21 string message; |
| 25 }; | 22 }; |
| 26 | 23 |
| 27 interface PresentationService { | 24 interface PresentationService { |
| 28 // Called when the frame sets or changes the default presentation URL or | 25 // Called when the frame sets or changes the default presentation URL or |
| 29 // presentation ID. | 26 // presentation ID. |
| 30 SetDefaultPresentationURL( | 27 SetDefaultPresentationURL( |
| 31 string default_presentation_url, | 28 string default_presentation_url, |
| 32 string? default_presentation_id); | 29 string? default_presentation_id); |
| 33 | 30 |
| 34 // Returns the last screen availability state if it’s changed since the last | 31 // Returns the last screen availability state if it’s changed since the last |
| 35 // time the method was called. The client has to call this method again when | 32 // time the method was called. The client has to call this method again when |
| 36 // handling the result (provided via Mojo callback) to get the next update | 33 // handling the result (provided via Mojo callback) to get the next update |
| 37 // about the availability status. | 34 // about the availability status. |
| 38 // May start discovery of the presentation screens. The implementation might | 35 // May start discovery of the presentation screens. The implementation might |
| 39 // stop discovery once there are no active calls to GetScreenAvailability. | 36 // stop discovery once there are no active calls to GetScreenAvailability. |
| 40 // |presentation_url| can be specified to help the implementation to filter | 37 // |presentation_url| can be specified to help the implementation to filter |
| 41 // out incompatible screens. | 38 // out incompatible screens. |
| 42 GetScreenAvailability(string? presentation_url) => (bool available); | 39 GetScreenAvailability(string? presentation_url) => |
| 40 (string? presentation_url, bool available); |
| 43 | 41 |
| 44 // Called when the frame no longer listens to the | 42 // Called when the frame no longer listens to the |
| 45 // |availablechange| event. | 43 // |availablechange| event. |
| 46 OnScreenAvailabilityListenerRemoved(string? presentation_url); | 44 OnScreenAvailabilityListenerRemoved(string? presentation_url); |
| 47 | 45 |
| 48 // Called when the renderer is ready to receive the browser initiated | 46 // Called when the renderer is ready to receive the browser initiated |
| 49 // session. If the default session is started by the embedder before this | 47 // session. If the default session is started by the embedder before this |
| 50 // call, the embedder may queue it and run the callback when the call is | 48 // call, the embedder may queue it and run the callback when the call is |
| 51 // performed. | 49 // performed. |
| 52 ListenForDefaultSessionStart() | 50 ListenForDefaultSessionStart() |
| (...skipping 11 matching lines...) Expand all Loading... |
| 64 // UA will generate the presentation id. | 62 // UA will generate the presentation id. |
| 65 StartSession(string presentation_url, string? presentation_id) | 63 StartSession(string presentation_url, string? presentation_id) |
| 66 => (PresentationSessionInfo? sessionInfo, PresentationError? error); | 64 => (PresentationSessionInfo? sessionInfo, PresentationError? error); |
| 67 | 65 |
| 68 // Called when joinSession() is called by the frame. The result callback | 66 // Called when joinSession() is called by the frame. The result callback |
| 69 // works the same as for the method above. JoinSession will join a known | 67 // works the same as for the method above. JoinSession will join a known |
| 70 // session (i.e. when the page navigates or the user opens another tab) | 68 // session (i.e. when the page navigates or the user opens another tab) |
| 71 // silently and without user action. | 69 // silently and without user action. |
| 72 JoinSession(string presentation_url, string? presentation_id) | 70 JoinSession(string presentation_url, string? presentation_id) |
| 73 => (PresentationSessionInfo? sessionInfo, PresentationError? error); | 71 => (PresentationSessionInfo? sessionInfo, PresentationError? error); |
| 74 }; | 72 }; |
| OLD | NEW |