tts.mojom 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // Copyright 2021 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.
  4. module crosapi.mojom;
  5. import "mojo/public/mojom/base/unguessable_token.mojom";
  6. // Events sent back from the TTS engine indicating the progress.
  7. [Stable, Extensible]
  8. enum TtsEventType {
  9. [Default] kStart = 0,
  10. kEnd = 1,
  11. kWord = 2,
  12. kSentence = 3,
  13. kMarker = 4,
  14. kInterrupted = 5,
  15. kCanceled = 6,
  16. kError = 7,
  17. kPause = 8,
  18. kResume = 9,
  19. };
  20. // Represents a tts voice.
  21. [Stable]
  22. struct TtsVoice {
  23. // Name of the voice.
  24. string voice_name;
  25. // ​​The language that this voice supports.
  26. string lang;
  27. // If true, the synthesis engine is a remote network resource.
  28. bool remote;
  29. // The ID of the extension providing this voice.
  30. string engine_id;
  31. // All of the callback events that this voice is capable of sending.
  32. array<TtsEventType> events;
  33. // If true, this is implemented by chromeOS platform's subclass of
  34. // TtsPlatformImpl. Otherwise, this is implemented in a content embedder.
  35. bool native;
  36. // Id of the native voice.
  37. string native_voice_identifier;
  38. };
  39. // Interface for Tts, implemented in ash-chrome. Used by lacros-chrome to
  40. // communicate with ash TtsController to send the voice data and
  41. // speech requests to ash.
  42. [Stable, Uuid="8550e8d0-a818-49a3-93c1-d8053a33b2e6"]
  43. interface Tts {
  44. // A TtsClient can register itself with Tts, so that Tts can communicate with
  45. // the remote TtsClient associated with a particular |browser_context_id| in
  46. // Lacros. |from_primary_profile| is true if |browser_context_id| is
  47. // associated with the primary user profile in Lacros.
  48. RegisterTtsClient@0(pending_remote<TtsClient> client,
  49. mojo_base.mojom.UnguessableToken browser_context_id,
  50. bool from_primary_profile);
  51. // Called when Lacros voices changed for BrowserContext associated with
  52. // |browser_context_id|, |lacros_voices| contains new Lacros voices.
  53. VoicesChanged@1(mojo_base.mojom.UnguessableToken browser_context_id,
  54. array<TtsVoice> lacros_voices);
  55. };
  56. // Interface for tts client. Implemented in lacros-chrome.
  57. // Each Tts client is associated with a browser context object in Lacros.
  58. // Used by ash-chrome to send voices to Lacros.
  59. [Stable, Uuid="60ce0365-451e-402d-9a1c-e57350f9a202"]
  60. interface TtsClient {
  61. // Called when voices changed in ash TtsController .
  62. // |all_voices| contains the new voices (provided by both Ash and
  63. // Lacros).
  64. VoicesChanged@0(array<TtsVoice> all_voices);
  65. };