tree: 92f21a3fc8d936beb1652380fc05600af445fa79 [path history] [tgz]
  1. test/
  2. BUILD.gn
  3. clipboard.cc
  4. clipboard.h
  5. clipboard_android.cc
  6. clipboard_android.h
  7. clipboard_android_test_support.cc
  8. clipboard_buffer.h
  9. clipboard_constants.cc
  10. clipboard_constants.h
  11. clipboard_constants_mac.mm
  12. clipboard_data.cc
  13. clipboard_data.h
  14. clipboard_data_endpoint.cc
  15. clipboard_data_unittest.cc
  16. clipboard_factory_ozone.cc
  17. clipboard_format_type.h
  18. clipboard_format_type_android.cc
  19. clipboard_format_type_aura.cc
  20. clipboard_format_type_mac.mm
  21. clipboard_format_type_win.cc
  22. clipboard_mac.h
  23. clipboard_mac.mm
  24. clipboard_mac_unittest.mm
  25. clipboard_metrics.cc
  26. clipboard_metrics.h
  27. clipboard_monitor.cc
  28. clipboard_monitor.h
  29. clipboard_non_backed.cc
  30. clipboard_non_backed.h
  31. clipboard_non_backed_unittest.cc
  32. clipboard_observer.cc
  33. clipboard_observer.h
  34. clipboard_ozone.cc
  35. clipboard_ozone.h
  36. clipboard_sequence_number_token.h
  37. clipboard_test_template.h
  38. clipboard_unittest.cc
  39. clipboard_util_mac.h
  40. clipboard_util_mac.mm
  41. clipboard_util_mac_unittest.mm
  42. clipboard_util_win.cc
  43. clipboard_util_win.h
  44. clipboard_win.cc
  45. clipboard_win.h
  46. clipboard_x11.cc
  47. clipboard_x11.h
  48. custom_data_helper.cc
  49. custom_data_helper.h
  50. custom_data_helper_unittest.cc
  51. DEPS
  52. DIR_METADATA
  53. file_info.cc
  54. file_info.h
  55. file_info_fuzzer.cc
  56. file_info_unittest.cc
  57. OWNERS
  58. README.md
  59. scoped_clipboard_writer.cc
  60. scoped_clipboard_writer.h
ui/base/clipboard/README.md

Browser Clipboard

Platform-neutral clipboard abstractions, to access platform-specific clipboards (copy/paste) without platform-specific code.

Clipboard Model

The clipboard can be thought of as an ordered dictionary keyed on format, with the value as the payload. This dictionary is implemented and accessed differently on different operating systems (OS’s).

Interfaces

Interfaces include:

  • Clipboard: reading/pasting from the clipboard.
  • ScopedClipboardWriter: writing/copying to the clipboard.
  • ClipboardObserver: notifications of clipboard events.
  • ClipboardFormatType: specifying clipboard formats.

Platform-specific behavior

While most platform-specific behavior should be abstracted away, some may still be exposed. For some notable platform-specific behavior exposed by these interfaces:

  • ClipboardAndroid has a more limited set of supported formats.
  • ClipboardObserver is only supported on some platforms, as other platforms may require (inefficient) polling to implement.
  • Every platform may have different combinations of clipboard formats written, or metadata written, for each clipboard format. For example, text in Windows is written with a carriage return accompanying newlines, and in Linux requires multiple MIME types to represent.
  • ClipboardX11 supports both the usual clipboard buffer (CLIPBOARD selection), as well as the middle-click paste buffer (PRIMARY selection). X11 selections are documented in more detail in X11 documentation.
  • DataTransferPolicyController is only currently exercised in ChromeOS.
  • ClipboardWin and ClipboardX11 have limits to the amount of registered clipboard formats. Windows has the smallest limit on the number of formats, at 16384, and explored in this article. After these system resources are exhausted, the underlying OS may be rendered unusable.