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: fix up logic errors 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 1377 matching lines...) Expand 10 before | Expand all | Expand 10 after
1388 void RenderViewImpl::OnForceRedraw(const ui::LatencyInfo& latency_info) { 1388 void RenderViewImpl::OnForceRedraw(const ui::LatencyInfo& latency_info) {
1389 if (RenderWidgetCompositor* rwc = compositor()) { 1389 if (RenderWidgetCompositor* rwc = compositor()) {
1390 rwc->QueueSwapPromise( 1390 rwc->QueueSwapPromise(
1391 base::MakeUnique<AlwaysDrawSwapPromise>(latency_info)); 1391 base::MakeUnique<AlwaysDrawSwapPromise>(latency_info));
1392 rwc->SetNeedsForcedRedraw(); 1392 rwc->SetNeedsForcedRedraw();
1393 } 1393 }
1394 } 1394 }
1395 1395
1396 // blink::WebViewClient ------------------------------------------------------ 1396 // blink::WebViewClient ------------------------------------------------------
1397 1397
1398 WebView* RenderViewImpl::CreateView(WebLocalFrame* creator, 1398 WebView* RenderViewImpl::CreateView(WebLocalFrame* creator,
ncarter (slow) 2017/04/17 20:52:15 FYI: dcheng and I had discussed moving this method
Charlie Harrison 2017/04/18 20:38:53 Good idea. I've added a todo to do this in a follo
1399 const WebURLRequest& request, 1399 const WebURLRequest& request,
1400 const WebWindowFeatures& features, 1400 const WebWindowFeatures& features,
1401 const WebString& frame_name, 1401 const WebString& frame_name,
1402 WebNavigationPolicy policy, 1402 WebNavigationPolicy policy,
1403 bool suppress_opener) { 1403 bool suppress_opener) {
1404 RenderFrameImpl* creator_frame = RenderFrameImpl::FromWebFrame(creator); 1404 RenderFrameImpl* creator_frame = RenderFrameImpl::FromWebFrame(creator);
1405 mojom::CreateNewWindowParamsPtr params = mojom::CreateNewWindowParams::New(); 1405 mojom::CreateNewWindowParamsPtr params = mojom::CreateNewWindowParams::New();
1406 params->opener_render_frame_id = creator_frame->GetRoutingID(); 1406 params->opener_render_frame_id = creator_frame->GetRoutingID();
1407 params->user_gesture = WebUserGestureIndicator::IsProcessingUserGesture(); 1407 params->user_gesture = WebUserGestureIndicator::IsProcessingUserGesture();
1408 if (GetContentClient()->renderer()->AllowPopup()) 1408 if (GetContentClient()->renderer()->AllowPopup())
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1443 } 1443 }
1444 params->features = ConvertWebWindowFeaturesToMojoWindowFeatures(features); 1444 params->features = ConvertWebWindowFeaturesToMojoWindowFeatures(features);
1445 1445
1446 // We preserve this information before sending the message since |params| is 1446 // We preserve this information before sending the message since |params| is
1447 // moved on send. 1447 // moved on send.
1448 bool is_background_tab = 1448 bool is_background_tab =
1449 params->disposition == WindowOpenDisposition::NEW_BACKGROUND_TAB; 1449 params->disposition == WindowOpenDisposition::NEW_BACKGROUND_TAB;
1450 bool opened_by_user_gesture = params->user_gesture; 1450 bool opened_by_user_gesture = params->user_gesture;
1451 1451
1452 mojom::CreateNewWindowReplyPtr reply; 1452 mojom::CreateNewWindowReplyPtr reply;
1453 RenderThreadImpl::current_render_message_filter()->CreateNewWindow( 1453 RenderThreadImpl::current_render_message_filter_ui()->CreateNewWindow(
1454 std::move(params), &reply); 1454 std::move(params), &reply);
1455 if (reply->route_id == MSG_ROUTING_NONE) 1455 if (reply->route_id == MSG_ROUTING_NONE)
1456 return nullptr; 1456 return nullptr;
1457 1457
1458 WebUserGestureIndicator::ConsumeUserGesture(); 1458 WebUserGestureIndicator::ConsumeUserGesture();
1459 1459
1460 // While this view may be a background extension page, it can spawn a visible 1460 // While this view may be a background extension page, it can spawn a visible
1461 // render view. So we just assume that the new one is not another background 1461 // render view. So we just assume that the new one is not another background
1462 // page instead of passing on our own value. 1462 // page instead of passing on our own value.
1463 // TODO(vangelis): Can we tell if the new view will be a background page? 1463 // TODO(vangelis): Can we tell if the new view will be a background page?
(...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after
2674 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); 2674 INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
2675 } 2675 }
2676 2676
2677 std::unique_ptr<InputEventAck> ack(new InputEventAck( 2677 std::unique_ptr<InputEventAck> ack(new InputEventAck(
2678 InputEventAckSource::MAIN_THREAD, input_event->GetType(), 2678 InputEventAckSource::MAIN_THREAD, input_event->GetType(),
2679 INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); 2679 INPUT_EVENT_ACK_STATE_NOT_CONSUMED));
2680 OnInputEventAck(std::move(ack)); 2680 OnInputEventAck(std::move(ack));
2681 } 2681 }
2682 2682
2683 } // namespace content 2683 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698