Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 2837683002: Remove opener URLs from CreateNewWindowParams. (Closed)
Patch Set: Fix browsertest. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/common/frame.mojom ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/render_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <memory> 9 #include <memory>
10 10
(...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after
1406 RenderFrameImpl* creator_frame = RenderFrameImpl::FromWebFrame(creator); 1406 RenderFrameImpl* creator_frame = RenderFrameImpl::FromWebFrame(creator);
1407 mojom::CreateNewWindowParamsPtr params = mojom::CreateNewWindowParams::New(); 1407 mojom::CreateNewWindowParamsPtr params = mojom::CreateNewWindowParams::New();
1408 params->user_gesture = WebUserGestureIndicator::IsProcessingUserGesture(); 1408 params->user_gesture = WebUserGestureIndicator::IsProcessingUserGesture();
1409 if (GetContentClient()->renderer()->AllowPopup()) 1409 if (GetContentClient()->renderer()->AllowPopup())
1410 params->user_gesture = true; 1410 params->user_gesture = true;
1411 params->window_container_type = WindowFeaturesToContainerType(features); 1411 params->window_container_type = WindowFeaturesToContainerType(features);
1412 params->session_storage_namespace_id = session_storage_namespace_id_; 1412 params->session_storage_namespace_id = session_storage_namespace_id_;
1413 if (frame_name != "_blank") 1413 if (frame_name != "_blank")
1414 params->frame_name = frame_name.Utf8( 1414 params->frame_name = frame_name.Utf8(
1415 WebString::UTF8ConversionMode::kStrictReplacingErrorsWithFFFD); 1415 WebString::UTF8ConversionMode::kStrictReplacingErrorsWithFFFD);
1416 params->opener_url = creator->GetDocument().Url();
1417 1416
1418 // The browser process uses the top frame's URL for a content settings check
1419 // to determine whether the popup is allowed. If the top frame is remote,
1420 // its URL is not available, so use its replicated origin instead.
1421 //
1422 // TODO(alexmos): This works fine for regular origins but may break path
1423 // matching for file URLs with OOP subframes that open popups. This should
1424 // be fixed by either moving this lookup to the browser process or removing
1425 // path-based matching for file URLs from content settings. See
1426 // https://crbug.com/466297.
1427 if (creator->Top()->IsWebLocalFrame()) {
1428 params->opener_top_level_frame_url = creator->Top()->GetDocument().Url();
1429 } else {
1430 params->opener_top_level_frame_url =
1431 url::Origin(creator->Top()->GetSecurityOrigin()).GetURL();
1432 }
1433
1434 GURL security_url(
1435 url::Origin(creator->GetDocument().GetSecurityOrigin()).GetURL());
1436 if (!security_url.is_valid())
1437 security_url = GURL();
1438 params->opener_security_origin = security_url;
1439 params->opener_suppressed = suppress_opener; 1417 params->opener_suppressed = suppress_opener;
1440 params->disposition = NavigationPolicyToDisposition(policy); 1418 params->disposition = NavigationPolicyToDisposition(policy);
1441 if (!request.IsNull()) { 1419 if (!request.IsNull()) {
1442 params->target_url = request.Url(); 1420 params->target_url = request.Url();
1443 params->referrer = GetReferrerFromRequest(creator, request); 1421 params->referrer = GetReferrerFromRequest(creator, request);
1444 } 1422 }
1445 params->features = ConvertWebWindowFeaturesToMojoWindowFeatures(features); 1423 params->features = ConvertWebWindowFeaturesToMojoWindowFeatures(features);
1446 1424
1447 // We preserve this information before sending the message since |params| is 1425 // We preserve this information before sending the message since |params| is
1448 // moved on send. 1426 // moved on send.
(...skipping 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after
2682 input_event.GetCoalescedEventsPointers(), latency_info, 2660 input_event.GetCoalescedEventsPointers(), latency_info,
2683 dispatch_type); 2661 dispatch_type);
2684 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; 2662 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED;
2685 } 2663 }
2686 idle_user_detector_->ActivityDetected(); 2664 idle_user_detector_->ActivityDetected();
2687 return RenderWidget::HandleInputEvent(input_event, latency_info, 2665 return RenderWidget::HandleInputEvent(input_event, latency_info,
2688 dispatch_type); 2666 dispatch_type);
2689 } 2667 }
2690 2668
2691 } // namespace content 2669 } // namespace content
OLDNEW
« no previous file with comments | « content/common/frame.mojom ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698