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

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: Move over to render frame (but not WebFrameClient yet) + a bunch of cleanups 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(); 1407 params->opener_render_frame_id = creator_frame->GetRoutingID();
1405 params->user_gesture = WebUserGestureIndicator::IsProcessingUserGesture(); 1408 params->user_gesture = WebUserGestureIndicator::IsProcessingUserGesture();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1441 } 1444 }
1442 params->features = ConvertWebWindowFeaturesToMojoWindowFeatures(features); 1445 params->features = ConvertWebWindowFeaturesToMojoWindowFeatures(features);
1443 1446
1444 // We preserve this information before sending the message since |params| is 1447 // We preserve this information before sending the message since |params| is
1445 // moved on send. 1448 // moved on send.
1446 bool is_background_tab = 1449 bool is_background_tab =
1447 params->disposition == WindowOpenDisposition::NEW_BACKGROUND_TAB; 1450 params->disposition == WindowOpenDisposition::NEW_BACKGROUND_TAB;
1448 bool opened_by_user_gesture = params->user_gesture; 1451 bool opened_by_user_gesture = params->user_gesture;
1449 1452
1450 mojom::CreateNewWindowReplyPtr reply; 1453 mojom::CreateNewWindowReplyPtr reply;
1451 RenderThreadImpl::current_render_message_filter()->CreateNewWindow( 1454 creator_frame->GetFrameHostIPC()->CreateNewWindow(std::move(params), &reply);
1452 std::move(params), &reply);
1453 if (reply->route_id == MSG_ROUTING_NONE) 1455 if (reply->route_id == MSG_ROUTING_NONE)
1454 return nullptr; 1456 return nullptr;
1455 1457
1456 WebUserGestureIndicator::ConsumeUserGesture(); 1458 WebUserGestureIndicator::ConsumeUserGesture();
1457 1459
1458 // 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
1459 // 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
1460 // page instead of passing on our own value. 1462 // page instead of passing on our own value.
1461 // 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?
1462 bool never_visible = false; 1464 bool never_visible = false;
(...skipping 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after
2672 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); 2674 INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
2673 } 2675 }
2674 2676
2675 std::unique_ptr<InputEventAck> ack(new InputEventAck( 2677 std::unique_ptr<InputEventAck> ack(new InputEventAck(
2676 InputEventAckSource::MAIN_THREAD, input_event->GetType(), 2678 InputEventAckSource::MAIN_THREAD, input_event->GetType(),
2677 INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); 2679 INPUT_EVENT_ACK_STATE_NOT_CONSUMED));
2678 OnInputEventAck(std::move(ack)); 2680 OnInputEventAck(std::move(ack));
2679 } 2681 }
2680 2682
2681 } // namespace content 2683 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698