management.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  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.management.FooType'.
  8. // Please run the closure compiler before committing changes.
  9. // See https://chromium.googlesource.com/chromium/src/+/master/docs/closure_compilation.md
  10. /** @fileoverview Externs generated from namespace: management */
  11. /** @const */
  12. chrome.management = {};
  13. /**
  14. * Information about an icon belonging to an extension, app, or theme.
  15. * @typedef {{
  16. * size: number,
  17. * url: string
  18. * }}
  19. * @see https://developer.chrome.com/extensions/management#type-IconInfo
  20. */
  21. chrome.management.IconInfo;
  22. /**
  23. * @enum {string}
  24. * @see https://developer.chrome.com/extensions/management#type-LaunchType
  25. */
  26. chrome.management.LaunchType = {
  27. OPEN_AS_REGULAR_TAB: 'OPEN_AS_REGULAR_TAB',
  28. OPEN_AS_PINNED_TAB: 'OPEN_AS_PINNED_TAB',
  29. OPEN_AS_WINDOW: 'OPEN_AS_WINDOW',
  30. OPEN_FULL_SCREEN: 'OPEN_FULL_SCREEN',
  31. };
  32. /**
  33. * @enum {string}
  34. * @see https://developer.chrome.com/extensions/management#type-ExtensionDisabledReason
  35. */
  36. chrome.management.ExtensionDisabledReason = {
  37. UNKNOWN: 'unknown',
  38. PERMISSIONS_INCREASE: 'permissions_increase',
  39. };
  40. /**
  41. * @enum {string}
  42. * @see https://developer.chrome.com/extensions/management#type-ExtensionType
  43. */
  44. chrome.management.ExtensionType = {
  45. EXTENSION: 'extension',
  46. HOSTED_APP: 'hosted_app',
  47. PACKAGED_APP: 'packaged_app',
  48. LEGACY_PACKAGED_APP: 'legacy_packaged_app',
  49. THEME: 'theme',
  50. LOGIN_SCREEN_EXTENSION: 'login_screen_extension',
  51. };
  52. /**
  53. * @enum {string}
  54. * @see https://developer.chrome.com/extensions/management#type-ExtensionInstallType
  55. */
  56. chrome.management.ExtensionInstallType = {
  57. ADMIN: 'admin',
  58. DEVELOPMENT: 'development',
  59. NORMAL: 'normal',
  60. SIDELOAD: 'sideload',
  61. OTHER: 'other',
  62. };
  63. /**
  64. * Information about an installed extension, app, or theme.
  65. * @typedef {{
  66. * id: string,
  67. * name: string,
  68. * shortName: string,
  69. * description: string,
  70. * version: string,
  71. * versionName: (string|undefined),
  72. * mayDisable: boolean,
  73. * mayEnable: (boolean|undefined),
  74. * enabled: boolean,
  75. * disabledReason: (!chrome.management.ExtensionDisabledReason|undefined),
  76. * isApp: boolean,
  77. * type: !chrome.management.ExtensionType,
  78. * appLaunchUrl: (string|undefined),
  79. * homepageUrl: (string|undefined),
  80. * updateUrl: (string|undefined),
  81. * offlineEnabled: boolean,
  82. * optionsUrl: string,
  83. * icons: (!Array<!chrome.management.IconInfo>|undefined),
  84. * permissions: !Array<string>,
  85. * hostPermissions: !Array<string>,
  86. * installType: !chrome.management.ExtensionInstallType,
  87. * launchType: (!chrome.management.LaunchType|undefined),
  88. * availableLaunchTypes: (!Array<!chrome.management.LaunchType>|undefined)
  89. * }}
  90. * @see https://developer.chrome.com/extensions/management#type-ExtensionInfo
  91. */
  92. chrome.management.ExtensionInfo;
  93. /**
  94. * Options for how to handle the extension's uninstallation.
  95. * @typedef {{
  96. * showConfirmDialog: (boolean|undefined)
  97. * }}
  98. * @see https://developer.chrome.com/extensions/management#type-UninstallOptions
  99. */
  100. chrome.management.UninstallOptions;
  101. /**
  102. * Returns a list of information about installed extensions and apps.
  103. * @param {function(!Array<!chrome.management.ExtensionInfo>): void=} callback
  104. * @see https://developer.chrome.com/extensions/management#method-getAll
  105. */
  106. chrome.management.getAll = function(callback) {};
  107. /**
  108. * Returns information about the installed extension, app, or theme that has the
  109. * given ID.
  110. * @param {string} id The ID from an item of $(ref:management.ExtensionInfo).
  111. * @param {function(!chrome.management.ExtensionInfo): void=} callback
  112. * @see https://developer.chrome.com/extensions/management#method-get
  113. */
  114. chrome.management.get = function(id, callback) {};
  115. /**
  116. * Returns information about the calling extension, app, or theme. Note: This
  117. * function can be used without requesting the 'management' permission in the
  118. * manifest.
  119. * @param {function(!chrome.management.ExtensionInfo): void=} callback
  120. * @see https://developer.chrome.com/extensions/management#method-getSelf
  121. */
  122. chrome.management.getSelf = function(callback) {};
  123. /**
  124. * Returns a list of <a href='permission_warnings'>permission warnings</a> for
  125. * the given extension id.
  126. * @param {string} id The ID of an already installed extension.
  127. * @param {function(!Array<string>): void=} callback
  128. * @see https://developer.chrome.com/extensions/management#method-getPermissionWarningsById
  129. */
  130. chrome.management.getPermissionWarningsById = function(id, callback) {};
  131. /**
  132. * Returns a list of <a href='permission_warnings'>permission warnings</a> for
  133. * the given extension manifest string. Note: This function can be used without
  134. * requesting the 'management' permission in the manifest.
  135. * @param {string} manifestStr Extension manifest JSON string.
  136. * @param {function(!Array<string>): void=} callback
  137. * @see https://developer.chrome.com/extensions/management#method-getPermissionWarningsByManifest
  138. */
  139. chrome.management.getPermissionWarningsByManifest = function(manifestStr, callback) {};
  140. /**
  141. * Enables or disables an app or extension. In most cases this function must be
  142. * called in the context of a user gesture (e.g. an onclick handler for a
  143. * button), and may present the user with a native confirmation UI as a way of
  144. * preventing abuse.
  145. * @param {string} id This should be the id from an item of
  146. * $(ref:management.ExtensionInfo).
  147. * @param {boolean} enabled Whether this item should be enabled or disabled.
  148. * @param {function(): void=} callback
  149. * @see https://developer.chrome.com/extensions/management#method-setEnabled
  150. */
  151. chrome.management.setEnabled = function(id, enabled, callback) {};
  152. /**
  153. * Uninstalls a currently installed app or extension. Note: This function does
  154. * not work in managed environments when the user is not allowed to uninstall
  155. * the specified extension/app.
  156. * @param {string} id This should be the id from an item of
  157. * $(ref:management.ExtensionInfo).
  158. * @param {!chrome.management.UninstallOptions=} options
  159. * @param {function(): void=} callback
  160. * @see https://developer.chrome.com/extensions/management#method-uninstall
  161. */
  162. chrome.management.uninstall = function(id, options, callback) {};
  163. /**
  164. * Uninstalls the calling extension. Note: This function can be used without
  165. * requesting the 'management' permission in the manifest. This function does
  166. * not work in managed environments when the user is not allowed to uninstall
  167. * the specified extension/app.
  168. * @param {!chrome.management.UninstallOptions=} options
  169. * @param {function(): void=} callback
  170. * @see https://developer.chrome.com/extensions/management#method-uninstallSelf
  171. */
  172. chrome.management.uninstallSelf = function(options, callback) {};
  173. /**
  174. * Launches an application.
  175. * @param {string} id The extension id of the application.
  176. * @param {function(): void=} callback
  177. * @see https://developer.chrome.com/extensions/management#method-launchApp
  178. */
  179. chrome.management.launchApp = function(id, callback) {};
  180. /**
  181. * Display options to create shortcuts for an app. On Mac, only packaged app
  182. * shortcuts can be created.
  183. * @param {string} id This should be the id from an app item of
  184. * $(ref:management.ExtensionInfo).
  185. * @param {function(): void=} callback
  186. * @see https://developer.chrome.com/extensions/management#method-createAppShortcut
  187. */
  188. chrome.management.createAppShortcut = function(id, callback) {};
  189. /**
  190. * Set the launch type of an app.
  191. * @param {string} id This should be the id from an app item of
  192. * $(ref:management.ExtensionInfo).
  193. * @param {!chrome.management.LaunchType} launchType The target launch type.
  194. * Always check and make sure this launch type is in
  195. * $(ref:ExtensionInfo.availableLaunchTypes), because the available launch
  196. * types vary on different platforms and configurations.
  197. * @param {function(): void=} callback
  198. * @see https://developer.chrome.com/extensions/management#method-setLaunchType
  199. */
  200. chrome.management.setLaunchType = function(id, launchType, callback) {};
  201. /**
  202. * Generate an app for a URL. Returns the generated bookmark app.
  203. * @param {string} url The URL of a web page. The scheme of the URL can only be
  204. * "http" or "https".
  205. * @param {string} title The title of the generated app.
  206. * @param {function(!chrome.management.ExtensionInfo): void=} callback
  207. * @see https://developer.chrome.com/extensions/management#method-generateAppForLink
  208. */
  209. chrome.management.generateAppForLink = function(url, title, callback) {};
  210. /**
  211. * Checks if the replacement android app can be installed. Errors generated by
  212. * this API are reported by setting $(ref:runtime.lastError) and executing the
  213. * function's regular callback.
  214. * @param {function(boolean): void} callback
  215. * @see https://developer.chrome.com/extensions/management#method-canInstallReplacementAndroidApp
  216. */
  217. chrome.management.canInstallReplacementAndroidApp = function(callback) {};
  218. /**
  219. * Prompts the user to install the replacement Android app from the manifest.
  220. * Errors generated by this API are reported by setting $(ref:runtime.lastError)
  221. * and executing the function's regular callback.
  222. * @param {function(): void=} callback
  223. * @see https://developer.chrome.com/extensions/management#method-installReplacementAndroidApp
  224. */
  225. chrome.management.installReplacementAndroidApp = function(callback) {};
  226. /**
  227. * Launches the replacement_web_app specified in the manifest. Prompts the user
  228. * to install if not already installed.
  229. * @param {function(): void=} callback
  230. * @see https://developer.chrome.com/extensions/management#method-installReplacementWebApp
  231. */
  232. chrome.management.installReplacementWebApp = function(callback) {};
  233. /**
  234. * Fired when an app or extension has been installed.
  235. * @type {!ChromeEvent}
  236. * @see https://developer.chrome.com/extensions/management#event-onInstalled
  237. */
  238. chrome.management.onInstalled;
  239. /**
  240. * Fired when an app or extension has been uninstalled.
  241. * @type {!ChromeEvent}
  242. * @see https://developer.chrome.com/extensions/management#event-onUninstalled
  243. */
  244. chrome.management.onUninstalled;
  245. /**
  246. * Fired when an app or extension has been enabled.
  247. * @type {!ChromeEvent}
  248. * @see https://developer.chrome.com/extensions/management#event-onEnabled
  249. */
  250. chrome.management.onEnabled;
  251. /**
  252. * Fired when an app or extension has been disabled.
  253. * @type {!ChromeEvent}
  254. * @see https://developer.chrome.com/extensions/management#event-onDisabled
  255. */
  256. chrome.management.onDisabled;