Cherry-pick "Android should be able to copy HTML snippets to the system clipboard."

Bug 10863973

Taken from upstream CL 9e7f61b8c (

Original description:

Currently the only clipboard data we actually push to the Android system
clipboard is plain-text data, so any formatting and links will be removed
when someone pastes content from Chromium to, for example, Gmail.

In order to push HTML data on the Android clipboard, we do need to know
the plain-text representation so that non-HTML consumers can still use
what's on there (there only is one primary clip). For that reason, we only
push HTML to the Android system clipboard if there also is a plain-text
representation available in the ClipboardMap.

There are a few situations in which we end up calling Clipboard::WriteHTML.
Android doesn't care about Pepper and drag and drop data right now. The
WebClipboardImpl::writeImage() method will write a HTML snippet, but we'll
ignore that because no plain-text data will be pasted. The fourth case is
WebClipboardImpl::writeHTML(), used for DOM fragments and rich content,
which will work fine after this patch.


Review URL:

Change-Id: I340c9befd8580e6f3de8d308053759054b9a8858
git-svn-id: svn:// 0039d316-1c4b-4281-b951-d872f2087c98
3 files changed