[go: nahoru, domu]

DLP: Use MainFrame origin to create endpoints

Changed DataTransferEndpoints creation to use the main frame
origin instead of the focused frame origin in order to
avoid the confusion of having some frames restricted and
others not restricted.

Bug: b/204275891
Change-Id: I56c6d53b73156cfa03082705391cf78471289c57
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3312267
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Aya Elsayed <ayaelattar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#949748}
diff --git a/ui/base/data_transfer_policy/data_transfer_endpoint.h b/ui/base/data_transfer_policy/data_transfer_endpoint.h
index 75815e0..eb97de2 100644
--- a/ui/base/data_transfer_policy/data_transfer_endpoint.h
+++ b/ui/base/data_transfer_policy/data_transfer_endpoint.h
@@ -40,6 +40,8 @@
 // if the data read is not allowed.)
 class COMPONENT_EXPORT(UI_BASE_DATA_TRANSFER_POLICY) DataTransferEndpoint {
  public:
+  // In case DataTransferEndpoint is constructed from a RenderFrameHost object,
+  // please use the origin of its main frame.
   explicit DataTransferEndpoint(const url::Origin& origin,
                                 bool notify_if_restricted = true);
   // This constructor shouldn't be used if |type| == EndpointType::kUrl.