Commit 88fcb3a6 authored by Mustaq Ahmed's avatar Mustaq Ahmed Committed by Commit Bot

Move user activation check to RemoteFrame::Navigate's callers.

Currently RemoteFrame::Navigate is the user of
Frame::HasTransientUserActivation that passes a RemoteFrame*, and
it seems wrong because the user activation (user gesture) needed by
the navigation should belong to the LocalFrame that initiated the
navigation.

Follow-up CLs after this one will update UserActivation code in
Frame to take a LocalFrame* instead of a Frame*, and get rid of
redundant IPCs.

Bug: 811414
Change-Id: I771c1694043edb54374a44213d16715d9c7da704
Reviewed-on: https://chromium-review.googlesource.com/914736
Commit-Queue: Mustaq Ahmed <mustaq@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#536728}
parent 8739ea65
......@@ -74,8 +74,6 @@ void RemoteFrame::Navigate(const FrameLoadRequest& passed_request) {
FrameLoader::UpgradeInsecureRequest(frame_request.GetResourceRequest(),
frame_request.OriginDocument());
frame_request.GetResourceRequest().SetHasUserGesture(
Frame::HasTransientUserActivation(this));
Client()->Navigate(frame_request.GetResourceRequest(),
frame_request.ReplacesCurrentItem());
}
......
......@@ -484,6 +484,8 @@ void HTMLFormElement::ScheduleFormSubmission(FormSubmission* submission) {
} else {
FrameLoadRequest frame_load_request =
submission->CreateFrameLoadRequest(&GetDocument());
frame_load_request.GetResourceRequest().SetHasUserGesture(
Frame::HasTransientUserActivation(GetDocument().GetFrame()));
ToRemoteFrame(target_frame)->Navigate(frame_load_request);
}
}
......
......@@ -298,6 +298,8 @@ void DragController::PerformDrag(DragData* drag_data, LocalFrame& local_root) {
// origin rather than the origin of the dragged data URL?
resource_request.SetRequestorOrigin(
SecurityOrigin::Create(KURL(drag_data->AsURL())));
resource_request.SetHasUserGesture(Frame::HasTransientUserActivation(
document_under_mouse_ ? document_under_mouse_->GetFrame() : nullptr));
page_->MainFrame()->Navigate(FrameLoadRequest(nullptr, resource_request));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment