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

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

Issue 2821473002: Service CreateNewWindow on the UI thread with a new mojo interface (Closed)
Patch Set: dcheng fixes + security exploit browsertest nerfing 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
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "content/common/content_constants_internal.h" 47 #include "content/common/content_constants_internal.h"
48 #include "content/common/content_switches_internal.h" 48 #include "content/common/content_switches_internal.h"
49 #include "content/common/dom_storage/dom_storage_types.h" 49 #include "content/common/dom_storage/dom_storage_types.h"
50 #include "content/common/drag_messages.h" 50 #include "content/common/drag_messages.h"
51 #include "content/common/frame_messages.h" 51 #include "content/common/frame_messages.h"
52 #include "content/common/frame_replication_state.h" 52 #include "content/common/frame_replication_state.h"
53 #include "content/common/input_messages.h" 53 #include "content/common/input_messages.h"
54 #include "content/common/page_messages.h" 54 #include "content/common/page_messages.h"
55 #include "content/common/render_message_filter.mojom.h" 55 #include "content/common/render_message_filter.mojom.h"
56 #include "content/common/view_messages.h" 56 #include "content/common/view_messages.h"
57 #include "content/public/common/associated_interface_provider.h"
57 #include "content/public/common/bindings_policy.h" 58 #include "content/public/common/bindings_policy.h"
58 #include "content/public/common/browser_side_navigation_policy.h" 59 #include "content/public/common/browser_side_navigation_policy.h"
59 #include "content/public/common/content_client.h" 60 #include "content/public/common/content_client.h"
60 #include "content/public/common/content_constants.h" 61 #include "content/public/common/content_constants.h"
61 #include "content/public/common/content_switches.h" 62 #include "content/public/common/content_switches.h"
62 #include "content/public/common/favicon_url.h" 63 #include "content/public/common/favicon_url.h"
63 #include "content/public/common/page_importance_signals.h" 64 #include "content/public/common/page_importance_signals.h"
64 #include "content/public/common/page_state.h" 65 #include "content/public/common/page_state.h"
65 #include "content/public/common/page_zoom.h" 66 #include "content/public/common/page_zoom.h"
66 #include "content/public/common/three_d_api_types.h" 67 #include "content/public/common/three_d_api_types.h"
(...skipping 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after
1386 void RenderViewImpl::OnForceRedraw(const ui::LatencyInfo& latency_info) { 1387 void RenderViewImpl::OnForceRedraw(const ui::LatencyInfo& latency_info) {
1387 if (RenderWidgetCompositor* rwc = compositor()) { 1388 if (RenderWidgetCompositor* rwc = compositor()) {
1388 rwc->QueueSwapPromise( 1389 rwc->QueueSwapPromise(
1389 base::MakeUnique<AlwaysDrawSwapPromise>(latency_info)); 1390 base::MakeUnique<AlwaysDrawSwapPromise>(latency_info));
1390 rwc->SetNeedsForcedRedraw(); 1391 rwc->SetNeedsForcedRedraw();
1391 } 1392 }
1392 } 1393 }
1393 1394
1394 // blink::WebViewClient ------------------------------------------------------ 1395 // blink::WebViewClient ------------------------------------------------------
1395 1396
1397 // TODO(csharrison): Migrate this method to WebFrameClient / RenderFrameImpl, as
1398 // it is now serviced by a mojo interface scoped to the opener frame.
1396 WebView* RenderViewImpl::CreateView(WebLocalFrame* creator, 1399 WebView* RenderViewImpl::CreateView(WebLocalFrame* creator,
1397 const WebURLRequest& request, 1400 const WebURLRequest& request,
1398 const WebWindowFeatures& features, 1401 const WebWindowFeatures& features,
1399 const WebString& frame_name, 1402 const WebString& frame_name,
1400 WebNavigationPolicy policy, 1403 WebNavigationPolicy policy,
1401 bool suppress_opener) { 1404 bool suppress_opener) {
1402 RenderFrameImpl* creator_frame = RenderFrameImpl::FromWebFrame(creator); 1405 RenderFrameImpl* creator_frame = RenderFrameImpl::FromWebFrame(creator);
1403 mojom::CreateNewWindowParamsPtr params = mojom::CreateNewWindowParams::New(); 1406 mojom::CreateNewWindowParamsPtr params = mojom::CreateNewWindowParams::New();
1404 params->opener_render_frame_id = creator_frame->GetRoutingID();
1405 params->user_gesture = WebUserGestureIndicator::IsProcessingUserGesture(); 1407 params->user_gesture = WebUserGestureIndicator::IsProcessingUserGesture();
1406 if (GetContentClient()->renderer()->AllowPopup()) 1408 if (GetContentClient()->renderer()->AllowPopup())
1407 params->user_gesture = true; 1409 params->user_gesture = true;
1408 params->window_container_type = WindowFeaturesToContainerType(features); 1410 params->window_container_type = WindowFeaturesToContainerType(features);
1409 params->session_storage_namespace_id = session_storage_namespace_id_; 1411 params->session_storage_namespace_id = session_storage_namespace_id_;
1410 if (frame_name != "_blank") 1412 if (frame_name != "_blank")
1411 params->frame_name = frame_name.Utf8( 1413 params->frame_name = frame_name.Utf8(
1412 WebString::UTF8ConversionMode::kStrictReplacingErrorsWithFFFD); 1414 WebString::UTF8ConversionMode::kStrictReplacingErrorsWithFFFD);
1413 params->opener_url = creator->GetDocument().Url(); 1415 params->opener_url = creator->GetDocument().Url();
1414 1416
(...skipping 26 matching lines...) Expand all
1441 } 1443 }
1442 params->features = ConvertWebWindowFeaturesToMojoWindowFeatures(features); 1444 params->features = ConvertWebWindowFeaturesToMojoWindowFeatures(features);
1443 1445
1444 // We preserve this information before sending the message since |params| is 1446 // We preserve this information before sending the message since |params| is
1445 // moved on send. 1447 // moved on send.
1446 bool is_background_tab = 1448 bool is_background_tab =
1447 params->disposition == WindowOpenDisposition::NEW_BACKGROUND_TAB; 1449 params->disposition == WindowOpenDisposition::NEW_BACKGROUND_TAB;
1448 bool opened_by_user_gesture = params->user_gesture; 1450 bool opened_by_user_gesture = params->user_gesture;
1449 1451
1450 mojom::CreateNewWindowReplyPtr reply; 1452 mojom::CreateNewWindowReplyPtr reply;
1451 RenderThreadImpl::current_render_message_filter()->CreateNewWindow( 1453 creator_frame->GetFrameHostIPC()->CreateNewWindow(std::move(params), &reply);
1452 std::move(params), &reply);
1453 if (reply->route_id == MSG_ROUTING_NONE) 1454 if (reply->route_id == MSG_ROUTING_NONE)
1454 return nullptr; 1455 return nullptr;
1455 1456
1456 WebUserGestureIndicator::ConsumeUserGesture(); 1457 WebUserGestureIndicator::ConsumeUserGesture();
1457 1458
1458 // While this view may be a background extension page, it can spawn a visible 1459 // While this view may be a background extension page, it can spawn a visible
1459 // render view. So we just assume that the new one is not another background 1460 // render view. So we just assume that the new one is not another background
1460 // page instead of passing on our own value. 1461 // page instead of passing on our own value.
1461 // TODO(vangelis): Can we tell if the new view will be a background page? 1462 // TODO(vangelis): Can we tell if the new view will be a background page?
1462 bool never_visible = false; 1463 bool never_visible = false;
(...skipping 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after
2672 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); 2673 INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
2673 } 2674 }
2674 2675
2675 std::unique_ptr<InputEventAck> ack(new InputEventAck( 2676 std::unique_ptr<InputEventAck> ack(new InputEventAck(
2676 InputEventAckSource::MAIN_THREAD, input_event->GetType(), 2677 InputEventAckSource::MAIN_THREAD, input_event->GetType(),
2677 INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); 2678 INPUT_EVENT_ACK_STATE_NOT_CONSUMED));
2678 OnInputEventAck(std::move(ack)); 2679 OnInputEventAck(std::move(ack));
2679 } 2680 }
2680 2681
2681 } // namespace content 2682 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698