clipboard.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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.clipboard.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: clipboard */
  11. /** @const */
  12. chrome.clipboard = {};
  13. /**
  14. * @enum {string}
  15. * @see https://developer.chrome.com/extensions/clipboard#type-ImageType
  16. */
  17. chrome.clipboard.ImageType = {
  18. PNG: 'png',
  19. JPEG: 'jpeg',
  20. };
  21. /**
  22. * @enum {string}
  23. * @see https://developer.chrome.com/extensions/clipboard#type-DataItemType
  24. */
  25. chrome.clipboard.DataItemType = {
  26. TEXT_PLAIN: 'textPlain',
  27. TEXT_HTML: 'textHtml',
  28. };
  29. /**
  30. * @typedef {{
  31. * type: !chrome.clipboard.DataItemType,
  32. * data: string
  33. * }}
  34. * @see https://developer.chrome.com/extensions/clipboard#type-AdditionalDataItem
  35. */
  36. chrome.clipboard.AdditionalDataItem;
  37. /**
  38. * Sets image data to clipboard.
  39. * @param {ArrayBuffer} imageData The encoded image data.
  40. * @param {!chrome.clipboard.ImageType} type The type of image being passed.
  41. * @param {!Array<!chrome.clipboard.AdditionalDataItem>=} additionalItems
  42. * Additional data items for describing image data. The callback is called
  43. * with <code>chrome.runtime.lastError</code> set to error code if there is
  44. * an error. Requires clipboard and clipboardWrite permissions.
  45. * @param {function(): void=} callback
  46. * @see https://developer.chrome.com/extensions/clipboard#method-setImageData
  47. */
  48. chrome.clipboard.setImageData = function(imageData, type, additionalItems, callback) {};
  49. /**
  50. * Fired when clipboard data changes. Requires clipboard and clipboardRead
  51. * permissions for adding listener to chrome.clipboard.onClipboardDataChanged
  52. * event. After this event fires, the clipboard data is available by calling
  53. * document.execCommand('paste').
  54. * @type {!ChromeEvent}
  55. * @see https://developer.chrome.com/extensions/clipboard#event-onClipboardDataChanged
  56. */
  57. chrome.clipboard.onClipboardDataChanged;