commit | 7f3199285c4c4d6b9443cdd2afd5c889d5677742 | [log] [tgz] |
---|---|---|
author | Maksim Sisov <msisov@igalia.com> | Mon Feb 11 13:25:10 2019 |
committer | Commit Bot <commit-bot@chromium.org> | Mon Feb 11 13:25:10 2019 |
tree | 965301bf8da9cca3769c17d06ce24e51c060a5f7 | |
parent | 0831d2ad101eff617912d7769115b9e3c6321950 [diff] |
[ozone] 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 is written to a system clipboard. And whenever the chromium browser is the selection owner, the cached data is used. components_unittests --gtest_filter=BookmarkUtilsTest* Bug: 875168 Test: interactive_ui_tests --gtest_filter=ClipboardTest* Change-Id: I0101aebe47cf2cac666f0434b6be2a9a11e2418c Reviewed-on: https://chromium-review.googlesource.com/c/1361872 Commit-Queue: Maksim Sisov <msisov@igalia.com> Reviewed-by: Scott Violet <sky@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Robert Kroeger <rjkroege@chromium.org> Cr-Commit-Position: refs/heads/master@{#630732}
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure .