Refactor copy protection code to use ClipboardPasteData
This CL changes copy protection code signatures to use the
`ClipboardPasteData` struct instead of `std::u16string`. This is done
in preparation of landing CLs like crrev.com/c/5287294 that need copy
protection code and paste protection code to use the same type to
represent clipboard data. This will also be useful when other copy
methods beyond `ClipboardHostImpl::WriteText` and
`ClipboardHostImpl::WriteHtml` are changed to support Data Controls.
Bug: b/313091312
Change-Id: I5f0723b97bbe7aaa68e45c03c62ebfed45527115
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5370261
Reviewed-by: Avi Drissman <[email protected]>
Commit-Queue: Dominique Fauteux-Chapleau <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1273016}
diff --git a/content/browser/renderer_host/clipboard_host_impl.h b/content/browser/renderer_host/clipboard_host_impl.h
index d33068d..a8aad24 100644
--- a/content/browser/renderer_host/clipboard_host_impl.h
+++ b/content/browser/renderer_host/clipboard_host_impl.h
@@ -18,6 +18,7 @@
#include "build/build_config.h"
#include "content/browser/renderer_host/render_frame_host_impl.h"
#include "content/common/content_export.h"
+#include "content/public/browser/clipboard_types.h"
#include "content/public/browser/document_service.h"
#include "mojo/public/cpp/base/big_buffer.h"
#include "mojo/public/cpp/bindings/receiver.h"
@@ -242,10 +243,10 @@
// the corresponding text/markup data to the clipboard. If it is not, instead
// write the replacement string to the clipboard as plaintext. This can be
// called asynchronously.
- void OnCopyTextAllowedResult(const std::u16string& text,
+ void OnCopyTextAllowedResult(const ClipboardPasteData& data,
std::optional<std::u16string> replacement_data);
void OnCopyHtmlAllowedResult(const GURL& url,
- const std::u16string& markup,
+ const ClipboardPasteData& data,
std::optional<std::u16string> replacement_data);
using CopyAllowedCallback = base::OnceCallback<void()>;