Propagate user activation state to RenderFrameHost clients.

UserActivationV2 calculates effective_transient_activation_state before
calling CanCreateWindow.
But it propagates params->mimic_user_gesture to clients, but it is not
valid value for user_gesture. This invalid value can confuse clients,
for example WebChromeClient#onCreateWindow webview api call.

[email protected]

Bug: 927254
Change-Id: I900a8f7f91a21f29bd54e3e8e0c74c41dfdd47fc
Reviewed-on: https://chromium-review.googlesource.com/c/1449392
Commit-Queue: Mustaq Ahmed <[email protected]>
Reviewed-by: Alex Moshchuk <[email protected]>
Reviewed-by: Mustaq Ahmed <[email protected]>
Reviewed-by: Richard Coles <[email protected]>
Cr-Commit-Position: refs/heads/master@{#630912}
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 74c9f5a..ea87008 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -2666,6 +2666,7 @@
     int32_t main_frame_route_id,
     int32_t main_frame_widget_route_id,
     const mojom::CreateNewWindowParams& params,
+    bool has_user_gesture,
     SessionStorageNamespace* session_storage_namespace) {
   // We should have zero valid routing ids, or three valid routing IDs.
   DCHECK_EQ((render_view_route_id == MSG_ROUTING_NONE),
@@ -2827,7 +2828,7 @@
       gfx::Rect initial_rect;  // Report an empty initial rect.
       delegate_->AddNewContents(this, std::move(owning_contents_impl),
                                 params.disposition, initial_rect,
-                                params.mimic_user_gesture, &was_blocked);
+                                has_user_gesture, &was_blocked);
       // The delegate may delete |new_contents_impl| during AddNewContents().
       if (!weak_new_contents)
         return;
@@ -2841,7 +2842,7 @@
       load_params->referrer = params.referrer.To<Referrer>();
       load_params->transition_type = ui::PAGE_TRANSITION_LINK;
       load_params->is_renderer_initiated = true;
-      load_params->has_user_gesture = params.mimic_user_gesture;
+      load_params->has_user_gesture = has_user_gesture;
 
       if (delegate_ && !is_guest &&
           !delegate_->ShouldResumeRequestsForCreatedWindow()) {