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

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: MakeShared goodness Created 3 years, 7 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 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after
1387 void RenderViewImpl::OnForceRedraw(const ui::LatencyInfo& latency_info) { 1388 void RenderViewImpl::OnForceRedraw(const ui::LatencyInfo& latency_info) {
1388 if (RenderWidgetCompositor* rwc = compositor()) { 1389 if (RenderWidgetCompositor* rwc = compositor()) {
1389 rwc->QueueSwapPromise( 1390 rwc->QueueSwapPromise(
1390 base::MakeUnique<AlwaysDrawSwapPromise>(latency_info)); 1391 base::MakeUnique<AlwaysDrawSwapPromise>(latency_info));
1391 rwc->SetNeedsForcedRedraw(); 1392 rwc->SetNeedsForcedRedraw();
1392 } 1393 }
1393 } 1394 }
1394 1395
1395 // blink::WebViewClient ------------------------------------------------------ 1396 // blink::WebViewClient ------------------------------------------------------
1396 1397
1398 // TODO(csharrison): Migrate this method to WebFrameClient / RenderFrameImpl, as
1399 // it is now serviced by a mojo interface scoped to the opener frame.
1397 WebView* RenderViewImpl::CreateView(WebLocalFrame* creator, 1400 WebView* RenderViewImpl::CreateView(WebLocalFrame* creator,
1398 const WebURLRequest& request, 1401 const WebURLRequest& request,
1399 const WebWindowFeatures& features, 1402 const WebWindowFeatures& features,
1400 const WebString& frame_name, 1403 const WebString& frame_name,
1401 WebNavigationPolicy policy, 1404 WebNavigationPolicy policy,
1402 bool suppress_opener) { 1405 bool suppress_opener) {
1403 RenderFrameImpl* creator_frame = RenderFrameImpl::FromWebFrame(creator); 1406 RenderFrameImpl* creator_frame = RenderFrameImpl::FromWebFrame(creator);
1404 mojom::CreateNewWindowParamsPtr params = mojom::CreateNewWindowParams::New(); 1407 mojom::CreateNewWindowParamsPtr params = mojom::CreateNewWindowParams::New();
1405 params->opener_render_frame_id = creator_frame->GetRoutingID();
1406 params->user_gesture = WebUserGestureIndicator::IsProcessingUserGesture(); 1408 params->user_gesture = WebUserGestureIndicator::IsProcessingUserGesture();
1407 if (GetContentClient()->renderer()->AllowPopup()) 1409 if (GetContentClient()->renderer()->AllowPopup())
1408 params->user_gesture = true; 1410 params->user_gesture = true;
1409 params->window_container_type = WindowFeaturesToContainerType(features); 1411 params->window_container_type = WindowFeaturesToContainerType(features);
1410 params->session_storage_namespace_id = session_storage_namespace_id_; 1412 params->session_storage_namespace_id = session_storage_namespace_id_;
1411 if (frame_name != "_blank") 1413 if (frame_name != "_blank")
1412 params->frame_name = frame_name.Utf8( 1414 params->frame_name = frame_name.Utf8(
1413 WebString::UTF8ConversionMode::kStrictReplacingErrorsWithFFFD); 1415 WebString::UTF8ConversionMode::kStrictReplacingErrorsWithFFFD);
1414 params->opener_url = creator->GetDocument().Url(); 1416 params->opener_url = creator->GetDocument().Url();
1415 1417
(...skipping 26 matching lines...) Expand all
1442 } 1444 }
1443 params->features = ConvertWebWindowFeaturesToMojoWindowFeatures(features); 1445 params->features = ConvertWebWindowFeaturesToMojoWindowFeatures(features);
1444 1446
1445 // We preserve this information before sending the message since |params| is 1447 // We preserve this information before sending the message since |params| is
1446 // moved on send. 1448 // moved on send.
1447 bool is_background_tab = 1449 bool is_background_tab =
1448 params->disposition == WindowOpenDisposition::NEW_BACKGROUND_TAB; 1450 params->disposition == WindowOpenDisposition::NEW_BACKGROUND_TAB;
1449 bool opened_by_user_gesture = params->user_gesture; 1451 bool opened_by_user_gesture = params->user_gesture;
1450 1452
1451 mojom::CreateNewWindowReplyPtr reply; 1453 mojom::CreateNewWindowReplyPtr reply;
1452 RenderThreadImpl::current_render_message_filter()->CreateNewWindow( 1454 mojom::FrameHostAssociatedPtr frame_host_ptr = creator_frame->GetFrameHost();
1453 std::move(params), &reply); 1455 frame_host_ptr->CreateNewWindow(std::move(params), &reply);
1454 if (reply->route_id == MSG_ROUTING_NONE) 1456 if (reply->route_id == MSG_ROUTING_NONE)
1455 return nullptr; 1457 return nullptr;
1456 1458
1457 WebUserGestureIndicator::ConsumeUserGesture(); 1459 WebUserGestureIndicator::ConsumeUserGesture();
1458 1460
1459 // While this view may be a background extension page, it can spawn a visible 1461 // While this view may be a background extension page, it can spawn a visible
1460 // render view. So we just assume that the new one is not another background 1462 // render view. So we just assume that the new one is not another background
1461 // page instead of passing on our own value. 1463 // page instead of passing on our own value.
1462 // TODO(vangelis): Can we tell if the new view will be a background page? 1464 // TODO(vangelis): Can we tell if the new view will be a background page?
1463 bool never_visible = false; 1465 bool never_visible = false;
(...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after
2680 input_event.GetCoalescedEventsPointers(), latency_info, 2682 input_event.GetCoalescedEventsPointers(), latency_info,
2681 dispatch_type); 2683 dispatch_type);
2682 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; 2684 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED;
2683 } 2685 }
2684 idle_user_detector_->ActivityDetected(); 2686 idle_user_detector_->ActivityDetected();
2685 return RenderWidget::HandleInputEvent(input_event, latency_info, 2687 return RenderWidget::HandleInputEvent(input_event, latency_info,
2686 dispatch_type); 2688 dispatch_type);
2687 } 2689 }
2688 2690
2689 } // namespace content 2691 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698