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