Perform content analysis when pasting a file with CTRL+V.
Bug: b:250975581
Change-Id: I6e83f3818ad2f517cde6ebd2b0af9252f400d710
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3968900
Reviewed-by: Dominique Fauteux-Chapleau <[email protected]>
Reviewed-by: Daniel Cheng <[email protected]>
Reviewed-by: Avi Drissman <[email protected]>
Commit-Queue: Roger Tawa <[email protected]>
Reviewed-by: Daniel Rubery <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1065102}
diff --git a/content/browser/renderer_host/clipboard_host_impl.h b/content/browser/renderer_host/clipboard_host_impl.h
index d37ab7f7..363b90fb 100644
--- a/content/browser/renderer_host/clipboard_host_impl.h
+++ b/content/browser/renderer_host/clipboard_host_impl.h
@@ -46,11 +46,14 @@
protected:
// These types and methods are protected for testing.
- using ClipboardPasteContentAllowed =
- RenderFrameHostImpl::ClipboardPasteContentAllowed;
using IsClipboardPasteContentAllowedCallback =
RenderFrameHostImpl::IsClipboardPasteContentAllowedCallback;
+ // Represents the underlying type of the argument passed to
+ // IsClipboardPasteContentAllowedCallback without the const& part.
+ using IsClipboardPasteContentAllowedCallbackArgType =
+ absl::optional<std::string>;
+
// Keeps track of a request to see if some clipboard content, identified by
// its sequence number, is allowed to be pasted into the RenderFrameHost
// that owns this clipboard host.
@@ -70,7 +73,7 @@
// Mark this request as completed with the specified result.
// Invoke all callbacks now.
- void Complete(ClipboardPasteContentAllowed allowed);
+ void Complete(IsClipboardPasteContentAllowedCallbackArgType data);
// Returns true if this request is obsolete. An obsolete request
// is one that is completed, all registered callbacks have been
@@ -88,7 +91,10 @@
void InvokeCallbacks();
base::Time time_{base::Time::Now()};
- absl::optional<ClipboardPasteContentAllowed> allowed_;
+
+ // The data argument to pass to the IsClipboardPasteContentAllowedCallback.
+ // This member is null until Complete() is called.
+ absl::optional<IsClipboardPasteContentAllowedCallbackArgType> data_;
std::vector<IsClipboardPasteContentAllowedCallback> callbacks_;
};
@@ -129,7 +135,7 @@
// status for the clipboard data corresponding to sequence number |seqno|.
void FinishPasteIfContentAllowed(
const ui::ClipboardSequenceNumberToken& seqno,
- ClipboardPasteContentAllowed allowed);
+ const absl::optional<std::string>& data);
const std::map<ui::ClipboardSequenceNumberToken,
IsPasteContentAllowedRequest>&