webview_tag.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519
  1. // Copyright 2014 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. // TODO(crbug.com/1085633): Inline enums need to be cleaned up in the source
  5. // specification before we can autogenerate this.
  6. /**
  7. * @typedef {{
  8. * since: (number|undefined)
  9. * }}
  10. * @see https://developer.chrome.com/apps/tags/webview#type-ClearDataOptions
  11. */
  12. var ClearDataOptions;
  13. /**
  14. * @typedef {{
  15. * appcache: (boolean|undefined),
  16. * cookies: (boolean|undefined),
  17. * fileSystems: (boolean|undefined),
  18. * indexedDB: (boolean|undefined),
  19. * localStorage: (boolean|undefined),
  20. * webSQL: (boolean|undefined)
  21. * }}
  22. * @see https://developer.chrome.com/apps/tags/webview#type-ClearDataTypeSet
  23. */
  24. var ClearDataTypeSet;
  25. /**
  26. * @typedef {{
  27. * code: (string|undefined),
  28. * file: (string|undefined)
  29. * }}
  30. * @see https://developer.chrome.com/apps/tags/webview#type-InjectDetails
  31. */
  32. var InjectDetails;
  33. /**
  34. * @constructor
  35. * @see https://developer.chrome.com/apps/tags/webview#type-ContentWindow
  36. */
  37. function ContentWindow() {}
  38. /**
  39. * @param {?} message
  40. * @param {string} targetOrigin
  41. */
  42. ContentWindow.prototype.postMessage = function(message, targetOrigin) {};
  43. /**
  44. * @constructor
  45. * @see https://developer.chrome.com/apps/tags/webview#type-DialogController
  46. */
  47. function DialogController() {}
  48. /**
  49. * @param {string} response
  50. */
  51. DialogController.prototype.ok = function(response) {};
  52. DialogController.prototype.cancel = function() {};
  53. /**
  54. * @typedef {{
  55. * numberOfMatches: number,
  56. * activeMatchOrdinal: number,
  57. * selectionRect: SelectionRect,
  58. * canceled: boolean
  59. * }}
  60. * @see https://developer.chrome.com/apps/tags/webview#type-FindCallbackResults
  61. */
  62. var FindCallbackResults;
  63. /**
  64. * @typedef {{
  65. * backward: (boolean|undefined),
  66. * matchCase: (boolean|undefined)
  67. * }}
  68. * @see https://developer.chrome.com/apps/tags/webview#type-FindOptions
  69. */
  70. var FindOptions;
  71. /**
  72. * @constructor
  73. * @see https://developer.chrome.com/apps/tags/webview#type-NewWindow
  74. */
  75. function NewWindow() {}
  76. /**
  77. * @param {!Object} webview
  78. */
  79. NewWindow.prototype.attach = function(webview) {};
  80. NewWindow.prototype.discard = function() {};
  81. /**
  82. * @constructor
  83. * @see https://developer.chrome.com/apps/tags/webview#type-MediaPermissionRequest
  84. */
  85. function MediaPermissionRequest() {}
  86. /** @type {string} */
  87. MediaPermissionRequest.prototype.url;
  88. MediaPermissionRequest.prototype.allow = function() {};
  89. MediaPermissionRequest.prototype.deny = function() {};
  90. /**
  91. * @constructor
  92. * @see https://developer.chrome.com/apps/tags/webview#type-GeolocationPermissionRequest
  93. */
  94. function GeolocationPermissionRequest() {}
  95. /** @type {string} */
  96. GeolocationPermissionRequest.prototype.url;
  97. GeolocationPermissionRequest.prototype.allow = function() {};
  98. GeolocationPermissionRequest.prototype.deny = function() {};
  99. /**
  100. * @constructor
  101. * @see https://developer.chrome.com/apps/tags/webview#type-PointerLockPermissionRequest
  102. */
  103. function PointerLockPermissionRequest() {}
  104. /** @type {boolean} */
  105. PointerLockPermissionRequest.prototype.userGesture;
  106. /** @type {boolean} */
  107. PointerLockPermissionRequest.prototype.lastUnlockedBySelf;
  108. /** @type {string} */
  109. PointerLockPermissionRequest.prototype.url;
  110. /**
  111. * @constructor
  112. * @see https://developer.chrome.com/apps/tags/webview#type-DownloadPermissionRequest
  113. */
  114. function DownloadPermissionRequest() {}
  115. /** @type {string} */
  116. DownloadPermissionRequest.prototype.requestMethod;
  117. /** @type {string} */
  118. DownloadPermissionRequest.prototype.url;
  119. DownloadPermissionRequest.prototype.allow = function() {};
  120. DownloadPermissionRequest.prototype.deny = function() {};
  121. /**
  122. * @constructor
  123. * @see https://developer.chrome.com/apps/tags/webview#type-FileSystemPermissionRequest
  124. */
  125. function FileSystemPermissionRequest() {}
  126. /** @type {string} */
  127. FileSystemPermissionRequest.prototype.url;
  128. FileSystemPermissionRequest.prototype.allow = function() {};
  129. FileSystemPermissionRequest.prototype.deny = function() {};
  130. /**
  131. * @constructor
  132. * @see https://developer.chrome.com/apps/tags/webview#type-LoadPluginPermissionRequest
  133. */
  134. function LoadPluginPermissionRequest() {}
  135. /** @type {string} */
  136. LoadPluginPermissionRequest.prototype.identifier;
  137. /** @type {string} */
  138. LoadPluginPermissionRequest.prototype.name;
  139. LoadPluginPermissionRequest.prototype.allow = function() {};
  140. LoadPluginPermissionRequest.prototype.deny = function() {};
  141. /**
  142. * @typedef {{
  143. * left: number,
  144. * top: number,
  145. * width: number,
  146. * height: number
  147. * }}
  148. */
  149. var SelectionRect;
  150. /**
  151. * @constructor
  152. * @see https://developer.chrome.com/apps/tags/webview#type-WebRequestEventInterface
  153. */
  154. function WebRequestEventInterface() {}
  155. /** @type {!WebRequestOptionallySynchronousEvent} */
  156. WebRequestEventInterface.prototype.onBeforeRequest;
  157. /** @type {!WebRequestOptionallySynchronousEvent} */
  158. WebRequestEventInterface.prototype.onBeforeSendHeaders;
  159. /** @type {!WebRequestEvent} */
  160. WebRequestEventInterface.prototype.onCompleted;
  161. /** @type {!WebRequestOnErrorOccurredEvent} */
  162. WebRequestEventInterface.prototype.onErrorOccurred;
  163. /** @type {!WebRequestOptionallySynchronousEvent} */
  164. WebRequestEventInterface.prototype.onHeadersReceived;
  165. /**
  166. * @constructor
  167. * @extends {HTMLIFrameElement}
  168. */
  169. function WebView() {}
  170. /**
  171. * @type {ContentWindow}
  172. * @see https://developer.chrome.com/apps/tags/webview#property-contentWindow
  173. */
  174. WebView.prototype.contentWindow;
  175. /**
  176. * @type {!WebRequestEventInterface}
  177. * @see https://developer.chrome.com/apps/tags/webview#property-request
  178. */
  179. WebView.prototype.request;
  180. /**
  181. * @constructor
  182. * @see https://developer.chrome.com/apps/tags/webview#type-ContextMenus
  183. */
  184. function ContextMenus() {}
  185. ContextMenus.prototype.onShow;
  186. ContextMenus.prototype.onShow.addListener = function() {};
  187. /**
  188. * @type {ContextMenus}
  189. * @see https://developer.chrome.com/apps/tags/webview#property-contextMenus
  190. */
  191. WebView.prototype.contextMenus;
  192. /**
  193. * @typedef{{
  194. * code: ?string,
  195. * files: ?Array<string>
  196. * }}
  197. * @see https://developer.chrome.com/apps/tags/webview#type-InjectionItems
  198. */
  199. var InjectionItems;
  200. /**
  201. * Details of the content script to inject.
  202. * @typedef{{
  203. * name: string,
  204. * matches: Array<string>,
  205. * exclude_matches: ?Array<string>,
  206. * match_about_blank: ?boolean,
  207. * css: ?InjectionItems,
  208. * js: ?InjectionItems,
  209. * run_at: ?string,
  210. * all_frames: ?boolean,
  211. * include_globs: ?Array<string>,
  212. * exclude_globs: ?Array<string>,
  213. * }}
  214. * @see https://developer.chrome.com/apps/tags/webview#type-ContentScriptDetails
  215. */
  216. var ContentScriptDetails;
  217. /**
  218. * @param {Array<ContentScriptDetails>} contentScriptList
  219. * @see https://developer.chrome.com/apps/tags/webview#method-addContentScripts
  220. */
  221. WebView.prototype.addContentScripts = function(contentScriptList) {};
  222. /**
  223. * @see https://developer.chrome.com/apps/tags/webview#method-back
  224. */
  225. WebView.prototype.back = function() {};
  226. /**
  227. * @return {boolean}
  228. * @see https://developer.chrome.com/apps/tags/webview#method-canGoBack
  229. */
  230. WebView.prototype.canGoBack = function() {};
  231. /**
  232. * @return {boolean}
  233. * @see https://developer.chrome.com/apps/tags/webview#method-canGoBack
  234. */
  235. WebView.prototype.canGoForward = function() {};
  236. /**
  237. * @param {ClearDataOptions} options
  238. * @param {ClearDataTypeSet} types
  239. * @param {Function=} opt_callback
  240. * @see https://developer.chrome.com/apps/tags/webview#method-clearData
  241. */
  242. WebView.prototype.clearData = function(options, types, opt_callback) {};
  243. /**
  244. * @param {InjectDetails} details
  245. * @param {Function=} opt_callback
  246. * @see https://developer.chrome.com/apps/tags/webview#method-executeScript
  247. */
  248. WebView.prototype.executeScript = function(details, opt_callback) {};
  249. /**
  250. * @param {string} searchText
  251. * @param {FindOptions=} opt_options
  252. * @param {Function=} opt_callback
  253. * @see https://developer.chrome.com/apps/tags/webview#method-find
  254. */
  255. WebView.prototype.find = function(searchText, opt_options, opt_callback) {};
  256. /**
  257. * @see https://developer.chrome.com/apps/tags/webview#method-forward
  258. */
  259. WebView.prototype.forward = function() {};
  260. /**
  261. * @return {number}
  262. * @see https://developer.chrome.com/apps/tags/webview#method-getProcessId
  263. */
  264. WebView.prototype.getProcessId = function() {};
  265. /**
  266. * @return {string}
  267. * @see https://developer.chrome.com/apps/tags/webview#method-getUserAgent
  268. */
  269. WebView.prototype.getUserAgent = function() {};
  270. /**
  271. * @param {Function} callback
  272. * @see https://developer.chrome.com/apps/tags/webview#method-getZoom
  273. */
  274. WebView.prototype.getZoom = function(callback) {};
  275. /**
  276. * @param {number} relativeIndex
  277. * @param {Function=} opt_callback
  278. * @see https://developer.chrome.com/apps/tags/webview#method-go
  279. */
  280. WebView.prototype.go = function(relativeIndex, opt_callback) {};
  281. /**
  282. * @param {InjectDetails} details
  283. * @param {Function=} opt_callback
  284. * @see https://developer.chrome.com/apps/tags/webview#method-insertCSS
  285. */
  286. WebView.prototype.insertCSS = function(details, opt_callback) {};
  287. /**
  288. * @return {boolean}
  289. * @see https://developer.chrome.com/apps/tags/webview#method-isUserAgentOverridden
  290. */
  291. WebView.prototype.isUserAgentOverridden = function() {};
  292. /**
  293. * @see https://developer.chrome.com/apps/tags/webview#method-print
  294. */
  295. WebView.prototype.print = function() {};
  296. /**
  297. * @see https://developer.chrome.com/apps/tags/webview#method-reload
  298. */
  299. WebView.prototype.reload = function() {};
  300. /**
  301. * @param {Array<string>} contentScriptList
  302. * @see https://developer.chrome.com/apps/tags/webview#method-removeContentScripts
  303. */
  304. WebView.prototype.removeContentScripts = function(contentScriptList) {};
  305. /**
  306. * @param {string} userAgent
  307. * @see https://developer.chrome.com/apps/tags/webview#method-setUserAgentOverride
  308. */
  309. WebView.prototype.setUserAgentOverride = function(userAgent) {};
  310. /**
  311. * @param {number} zoomFactor
  312. * @param {Function=} opt_callback
  313. * @see https://developer.chrome.com/apps/tags/webview#method-setZoom
  314. */
  315. WebView.prototype.setZoom = function(zoomFactor, opt_callback) {};
  316. /**
  317. * @param {string} zoomMode Allowed values: "per-origin", "per-view", "disabled"
  318. * @see https://developer.chrome.com/apps/tags/webview#type-ZoomMode
  319. * @param {Function=} opt_callback
  320. * @see https://developer.chrome.com/apps/tags/webview#method-setZoomMode
  321. */
  322. WebView.prototype.setZoomMode = function(zoomMode, opt_callback) {};
  323. /**
  324. * @see https://developer.chrome.com/apps/tags/webview#method-stop
  325. */
  326. WebView.prototype.stop = function() {};
  327. /**
  328. * @param {?=} opt_action
  329. */
  330. WebView.prototype.stopFinding = function(opt_action) {};
  331. /**
  332. * @param {string} dataUrl
  333. * @param {string} baseUrl
  334. * @param {string=} opt_virtualUrl
  335. * @see https://developer.chrome.com/apps/tags/webview#method-stopFinding
  336. */
  337. WebView.prototype.loadDataWithBaseUrl =
  338. function(dataUrl, baseUrl, opt_virtualUrl) {};
  339. /**
  340. * @see https://developer.chrome.com/apps/tags/webview#method-terminate
  341. */
  342. WebView.prototype.terminate = function() {};
  343. /**
  344. * @constructor
  345. * @extends {Event}
  346. */
  347. function NewWindowEvent() {}
  348. /** @type {NewWindow} */
  349. NewWindowEvent.prototype.window;
  350. /** @type {string} */
  351. NewWindowEvent.prototype.targetUrl;
  352. /** @type {number} */
  353. NewWindowEvent.prototype.initialWidth;
  354. /** @type {number} */
  355. NewWindowEvent.prototype.initialHeight;
  356. /** @type {string} */
  357. NewWindowEvent.prototype.name;
  358. /**
  359. * @typedef {{
  360. * url: string,
  361. * isTopLevel: boolean,
  362. * code: number,
  363. * reason: string
  364. * }}
  365. * @see https://developer.chrome.com/apps/tags/webview#event-loadabort
  366. */
  367. var WebviewLoadAbortEventData;
  368. /** @type {!ChromeEvent} */
  369. WebView.prototype.close;
  370. /** @type {!ChromeEvent} */
  371. WebView.prototype.consolemessage;
  372. /** @type {!ChromeEvent} */
  373. WebView.prototype.contentload;
  374. /** @type {!ChromeEvent} */
  375. WebView.prototype.dialog;
  376. /** @type {!ChromeEvent} */
  377. WebView.prototype.exit;
  378. /** @type {!ChromeEvent} */
  379. WebView.prototype.findupdate;
  380. /** @type {!ChromeBaseEvent<WebviewLoadAbortEventData>} */
  381. WebView.prototype.loadabort;
  382. /** @type {!ChromeEvent} */
  383. WebView.prototype.loadcommit;
  384. /** @type {!ChromeEvent} */
  385. WebView.prototype.loadredirect;
  386. /** @type {!ChromeEvent} */
  387. WebView.prototype.loadstart;
  388. /** @type {!ChromeEvent} */
  389. WebView.prototype.loadstop;
  390. /**
  391. * "newwindow" event object properties.
  392. * @typedef{{
  393. * window: NewWindow,
  394. * targetUrl: string,
  395. * initialWidth: number,
  396. * initialHeight: number,
  397. * name: string,
  398. * windowOpenDisposition: string
  399. * }}
  400. * @see https://developer.chrome.com/apps/tags/webview#event-newwindow
  401. */
  402. var NewWindowProperties;
  403. /** @type {!ChromeEvent} */
  404. WebView.prototype.newwindow;
  405. /** @type {!ChromeEvent} */
  406. WebView.prototype.permissionrequest;
  407. /** @type {!ChromeEvent} */
  408. WebView.prototype.responsive;
  409. /** @type {!ChromeEvent} */
  410. WebView.prototype.sizechanged;
  411. /** @type {!ChromeEvent} */
  412. WebView.prototype.unresponsive;
  413. /** @type {!ChromeEvent} */
  414. WebView.prototype.zoomchange;