language_settings_private.js 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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. // This file was generated by:
  5. // tools/json_schema_compiler/compiler.py.
  6. // NOTE: The format of types has changed. 'FooType' is now
  7. // 'chrome.languageSettingsPrivate.FooType'.
  8. // Please run the closure compiler before committing changes.
  9. // See https://chromium.googlesource.com/chromium/src/+/main/docs/closure_compilation.md
  10. /** @fileoverview Externs generated from namespace: languageSettingsPrivate */
  11. /** @const */
  12. chrome.languageSettingsPrivate = {};
  13. /**
  14. * @enum {string}
  15. */
  16. chrome.languageSettingsPrivate.MoveType = {
  17. TOP: 'TOP',
  18. UP: 'UP',
  19. DOWN: 'DOWN',
  20. UNKNOWN: 'UNKNOWN',
  21. };
  22. /**
  23. * @typedef {{
  24. * code: string,
  25. * displayName: string,
  26. * nativeDisplayName: string,
  27. * supportsUI: (boolean|undefined),
  28. * supportsSpellcheck: (boolean|undefined),
  29. * supportsTranslate: (boolean|undefined),
  30. * isProhibitedLanguage: (boolean|undefined)
  31. * }}
  32. */
  33. chrome.languageSettingsPrivate.Language;
  34. /**
  35. * @typedef {{
  36. * languageCode: string,
  37. * isReady: boolean,
  38. * isDownloading: (boolean|undefined),
  39. * downloadFailed: (boolean|undefined)
  40. * }}
  41. */
  42. chrome.languageSettingsPrivate.SpellcheckDictionaryStatus;
  43. /**
  44. * @typedef {{
  45. * id: string,
  46. * displayName: string,
  47. * languageCodes: !Array<string>,
  48. * tags: !Array<string>,
  49. * enabled: (boolean|undefined),
  50. * hasOptionsPage: (boolean|undefined),
  51. * isProhibitedByPolicy: (boolean|undefined)
  52. * }}
  53. */
  54. chrome.languageSettingsPrivate.InputMethod;
  55. /**
  56. * @typedef {{
  57. * componentExtensionImes: !Array<!chrome.languageSettingsPrivate.InputMethod>,
  58. * thirdPartyExtensionImes: !Array<!chrome.languageSettingsPrivate.InputMethod>
  59. * }}
  60. */
  61. chrome.languageSettingsPrivate.InputMethodLists;
  62. /**
  63. * Gets languages available for translate, spell checking, input and locale.
  64. * @param {function(!Array<!chrome.languageSettingsPrivate.Language>): void}
  65. * callback
  66. */
  67. chrome.languageSettingsPrivate.getLanguageList = function(callback) {};
  68. /**
  69. * Enables a language, adding it to the Accept-Language list (used to decide
  70. * which languages to translate, generate the Accept-Language header, etc.).
  71. * @param {string} languageCode
  72. */
  73. chrome.languageSettingsPrivate.enableLanguage = function(languageCode) {};
  74. /**
  75. * Disables a language, removing it from the Accept-Language list.
  76. * @param {string} languageCode
  77. */
  78. chrome.languageSettingsPrivate.disableLanguage = function(languageCode) {};
  79. /**
  80. * Enables or disables translation for a given language.
  81. * @param {string} languageCode
  82. * @param {boolean} enable
  83. */
  84. chrome.languageSettingsPrivate.setEnableTranslationForLanguage = function(languageCode, enable) {};
  85. /**
  86. * Moves a language inside the language list.
  87. * @param {string} languageCode
  88. * @param {!chrome.languageSettingsPrivate.MoveType} moveType
  89. */
  90. chrome.languageSettingsPrivate.moveLanguage = function(languageCode, moveType) {};
  91. /**
  92. * Gets languages that should always be automatically translated.
  93. * @param {function(!Array<string>): void} callback
  94. */
  95. chrome.languageSettingsPrivate.getAlwaysTranslateLanguages = function(callback) {};
  96. /**
  97. * Sets whether a given language should always be automatically translated.
  98. * @param {string} languageCode
  99. * @param {boolean} alwaysTranslate
  100. */
  101. chrome.languageSettingsPrivate.setLanguageAlwaysTranslateState = function(languageCode, alwaysTranslate) {};
  102. /**
  103. * Gets languages that should never be offered to translate.
  104. * @param {function(!Array<string>): void} callback
  105. */
  106. chrome.languageSettingsPrivate.getNeverTranslateLanguages = function(callback) {};
  107. /**
  108. * Gets the current status of the chosen spell check dictionaries.
  109. * @param {function(!Array<!chrome.languageSettingsPrivate.SpellcheckDictionaryStatus>): void}
  110. * callback
  111. */
  112. chrome.languageSettingsPrivate.getSpellcheckDictionaryStatuses = function(callback) {};
  113. /**
  114. * Gets the custom spell check words, in sorted order.
  115. * @param {function(!Array<string>): void} callback
  116. */
  117. chrome.languageSettingsPrivate.getSpellcheckWords = function(callback) {};
  118. /**
  119. * Adds a word to the custom dictionary.
  120. * @param {string} word
  121. */
  122. chrome.languageSettingsPrivate.addSpellcheckWord = function(word) {};
  123. /**
  124. * Removes a word from the custom dictionary.
  125. * @param {string} word
  126. */
  127. chrome.languageSettingsPrivate.removeSpellcheckWord = function(word) {};
  128. /**
  129. * Gets the translate target language (in most cases, the display locale).
  130. * @param {function(string): void} callback
  131. */
  132. chrome.languageSettingsPrivate.getTranslateTargetLanguage = function(callback) {};
  133. /**
  134. * Sets the translate target language given a language code.
  135. * @param {string} languageCode
  136. */
  137. chrome.languageSettingsPrivate.setTranslateTargetLanguage = function(languageCode) {};
  138. /**
  139. * Gets all supported input methods, including third-party IMEs. Chrome OS only.
  140. * @param {function(!chrome.languageSettingsPrivate.InputMethodLists): void}
  141. * callback
  142. */
  143. chrome.languageSettingsPrivate.getInputMethodLists = function(callback) {};
  144. /**
  145. * Adds the input method to the current user's list of enabled input methods,
  146. * enabling the input method for the current user. Chrome OS only.
  147. * @param {string} inputMethodId
  148. */
  149. chrome.languageSettingsPrivate.addInputMethod = function(inputMethodId) {};
  150. /**
  151. * Removes the input method from the current user's list of enabled input
  152. * methods, disabling the input method for the current user. Chrome OS only.
  153. * @param {string} inputMethodId
  154. */
  155. chrome.languageSettingsPrivate.removeInputMethod = function(inputMethodId) {};
  156. /**
  157. * Tries to download the dictionary after a failed download.
  158. * @param {string} languageCode
  159. */
  160. chrome.languageSettingsPrivate.retryDownloadDictionary = function(languageCode) {};
  161. /**
  162. * Called when the pref for the dictionaries used for spell checking changes or
  163. * the status of one of the spell check dictionaries changes.
  164. * @type {!ChromeEvent}
  165. */
  166. chrome.languageSettingsPrivate.onSpellcheckDictionariesChanged;
  167. /**
  168. * Called when words are added to and/or removed from the custom spell check
  169. * dictionary.
  170. * @type {!ChromeEvent}
  171. */
  172. chrome.languageSettingsPrivate.onCustomDictionaryChanged;
  173. /**
  174. * Called when an input method is added.
  175. * @type {!ChromeEvent}
  176. */
  177. chrome.languageSettingsPrivate.onInputMethodAdded;
  178. /**
  179. * Called when an input method is removed.
  180. * @type {!ChromeEvent}
  181. */
  182. chrome.languageSettingsPrivate.onInputMethodRemoved;