File: language_packs.mojom

package info (click to toggle)
chromium 138.0.7204.183-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,071,908 kB
  • sloc: cpp: 34,937,088; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,953; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,806; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (124 lines) | stat: -rw-r--r-- 4,372 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Private API exposed by Language Packs.
// It allows clients to check, request and observe the files managed by
// Language Packs.

module ash.language.mojom;

// ID of the Feature using LanguagePacks.
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused. When adding new enumerations to this
// enum, you must add those to the LanguagePackMojoFeatureId definition in
// tools/metrics/histograms/enums.xml to keep them in sync.
// Next MinVersion: 2
// TODO(b/335692393): Add a default value for FeatureId.
[Extensible]
enum FeatureId {
  // Unknown feature, not supported.
  UNSUPPORTED_UNKNOWN = 0,
  // Handwriting Recognition used by the Virtual Keyboard.
  HANDWRITING_RECOGNITION = 1,
  // Text-To-Speech feature.
  [MinVersion=1] TTS = 2,
};

// Current state of Pack on disk.
// INSTALLED means that it's mounted and can be used.
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.  When adding new enumerations to this
// enum, you must add those to the LanguagePackMojoPackState definition in
// tools/metrics/histograms/enums.xml to keep them in sync.
// Next MinVersion: 4
[Extensible]
enum PackState {
  // TODO: b/294162606 - Deprecate this value and use UNKNOWN instead.
  ERROR = 0,
  NOT_INSTALLED = 1,
  INSTALLING = 2,
  INSTALLED = 3,
  [MinVersion=3, Default] UNKNOWN = 4
};

// The error that is encountered when performing an IPC operation.
// Next MinVersion: 1
[Extensible]
enum ErrorCode {
  [Default] kUnknown = 0,
  kNone = 1,
  kOther = 2,
  kWrongId = 3,
  kNeedReboot = 4,
  kAllocation = 5
};

// This struct holds information that allows clients to use a Language Pack.
// Next MinVersion: 4
struct LanguagePackInfo {
  PackState pack_state;
  string path;
  [MinVersion=2] ErrorCode error;
  [MinVersion=3] FeatureId feature_id;
  [MinVersion=3] string? locale;
};

// This struct holds information that allows clients to use a Base Pack.
// Next MinVersion: 3
struct BasePackInfo {
  PackState pack_state;
  string path;
  [MinVersion=2] ErrorCode error;
};

// Interface for observing Language Packs.
// It allows clients to get notifications when the state of a Language Pack
// changes.
// Next ordinal: 1
// Next MinVersion: 1
interface LanguagePacksObserver {
  // Called whenever the state of a Language Pack is changed.
  OnPackStateChanged@0(LanguagePackInfo info);
};

// Interface for managing Language Packs.
// It allows clients to get information about a Language Pack or to alter the
// installation of one.
// Language Packs are mounted to the user partition once they are installed and
// this interface allows to get the path to the files.
// Next ordinal: 5
// Next MinVersion: 2
interface LanguagePacks {
  // Gets information about the current state of a Language Pack.
  // Takes the id of the feature (for example handwriting) and the language.
  // It returns |info| which contains details about the pack and error
  // information if any.
  GetPackInfo@0(FeatureId feature_id, string language) =>
      (LanguagePackInfo info);

  // Requests to install a Language Pack.
  // Takes the id of the feature (for example handwriting) and the language.
  // It returns |info| which contains details about the pack and error
  // information if any.
  InstallPack@1(FeatureId feature_id, string language) =>
      (LanguagePackInfo info);

  // Requests to install the Base Pack for a `feature_id`.
  // The Base Pack contains the dependencies needed for a Language Pack to
  // function correctly.
  // Takes the id of the feature (for example handwriting).
  // If there's no Base Pack for the specified feature, then `info` will have an
  // ERROR PackState.
  InstallBasePack@2(FeatureId feature_id) =>
      (BasePackInfo info);

  // Requests to uninstall a Language Pack.
  // Takes the id of the feature (for example handwriting) and the language.
  UninstallPack@3(FeatureId feature_id, string language) => ();

  // Adds an observer to observe Language Packs. Observers can live in the
  // browser, renderer, or extension process.
  [MinVersion=1] AddObserver@4(
      pending_associated_remote<LanguagePacksObserver> observer);
};