Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DoNotCarryForward] Implement Clipboard for Ozone platforms.
This patch provides a general clipboard implementation for Ozone. The initialization happens automatically: Clipboard::Create->ClipboardOzone::ClipboardOzone()-> AsyncClipboardOzone::AsyncClipboardOzone()->ClipboardDelegate::GetInstance(). where ClipboardOzone is a derived class from base::Clipboard, AsyncClipboardOzone is a private helper class of ClipboardOzone, which gets calls from it, makes requests and sends them to ClipboardDelegate. TL;DR: The ClipboardDelegate::GetInstance stores a singleton delegate instance, which is stored automatically once clipboard delegate is created. Each ozone platform, which uses clipboard, is responsible to create own instance of ClipboardDelegate, which communicates with a system clipboard. If a platform does not have own, the ClipboardDelegate::GetInstance creates a FakeClipboardDelegate, which emulates the system clipboard in such a way that it can pass unittests and provide copy/paste functionality within browser. The flow is asynchronous and based on requests.That is, whenever a ClipboardOzone receives a Read/Write/GetMime call, it forwards it to the helper AsyncClipboardOzone class, which then creates a request (used for internal usage and holding data filled by the ClipboardDelegate), calls to the delegate and start an abort timer to make sure the request is not stalled. What is more the clipboard data is cached and removed only when another chunk of data iss written to a system clipboard. And whenever the chromium browser is the selection owner, the cached data is used. Bug: 875168 Test: interactive_ui_tests --gtest_filter=ClipboardTest* components_unittests --gtest_filter=BookmarkUtilsTest* Change-Id: I0101aebe47cf2cac666f0434b6be2a9a11e2418c
- Loading branch information