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

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

Issue 692973005: Pass origin information for remote frame creation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 command_line.HasSwitch(switches::kAllowInsecureWebSocketFromHttpsOrigin)); 759 command_line.HasSwitch(switches::kAllowInsecureWebSocketFromHttpsOrigin));
760 760
761 RenderFrameProxy* proxy = NULL; 761 RenderFrameProxy* proxy = NULL;
762 if (params->proxy_routing_id != MSG_ROUTING_NONE) { 762 if (params->proxy_routing_id != MSG_ROUTING_NONE) {
763 CHECK(params->swapped_out); 763 CHECK(params->swapped_out);
764 proxy = RenderFrameProxy::CreateProxyToReplaceFrame( 764 proxy = RenderFrameProxy::CreateProxyToReplaceFrame(
765 main_render_frame_.get(), params->proxy_routing_id); 765 main_render_frame_.get(), params->proxy_routing_id);
766 main_render_frame_->set_render_frame_proxy(proxy); 766 main_render_frame_->set_render_frame_proxy(proxy);
767 } 767 }
768 768
769 bool is_site_per_process =
770 CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess);
771
769 // In --site-per-process, just use the WebRemoteFrame as the main frame. 772 // In --site-per-process, just use the WebRemoteFrame as the main frame.
770 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess) && 773 if (is_site_per_process && proxy) {
771 proxy) {
772 webview()->setMainFrame(proxy->web_frame()); 774 webview()->setMainFrame(proxy->web_frame());
773 } else { 775 } else {
774 webview()->setMainFrame(main_render_frame_->GetWebFrame()); 776 webview()->setMainFrame(main_render_frame_->GetWebFrame());
775 } 777 }
776 main_render_frame_->Initialize(); 778 main_render_frame_->Initialize();
777 779
780 // In --site-per-process, the browser process passes us state replicated from
781 // the process where this frame is being rendered. Use this to initialize
782 // the remote frame's security origin.
783 if (is_site_per_process && proxy) {
784 proxy->web_frame()->setReplicatedOrigin(
785 blink::WebURL(GURL(params->remote_frame_state.origin.string())),
786 params->remote_frame_state.is_unique_origin);
787 }
788
778 if (switches::IsTouchDragDropEnabled()) 789 if (switches::IsTouchDragDropEnabled())
779 webview()->settings()->setTouchDragDropEnabled(true); 790 webview()->settings()->setTouchDragDropEnabled(true);
780 791
781 if (switches::IsTouchEditingEnabled()) 792 if (switches::IsTouchEditingEnabled())
782 webview()->settings()->setTouchEditingEnabled(true); 793 webview()->settings()->setTouchEditingEnabled(true);
783 794
784 if (!params->frame_name.empty()) 795 if (!params->frame_name.empty())
785 webview()->mainFrame()->setName(params->frame_name); 796 webview()->mainFrame()->setName(params->frame_name);
786 797
787 // TODO(davidben): Move this state from Blink into content. 798 // TODO(davidben): Move this state from Blink into content.
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 int32 main_frame_routing_id, 1146 int32 main_frame_routing_id,
1136 int32 surface_id, 1147 int32 surface_id,
1137 int64 session_storage_namespace_id, 1148 int64 session_storage_namespace_id,
1138 const base::string16& frame_name, 1149 const base::string16& frame_name,
1139 bool is_renderer_created, 1150 bool is_renderer_created,
1140 bool swapped_out, 1151 bool swapped_out,
1141 int32 proxy_routing_id, 1152 int32 proxy_routing_id,
1142 bool hidden, 1153 bool hidden,
1143 bool never_visible, 1154 bool never_visible,
1144 int32 next_page_id, 1155 int32 next_page_id,
1145 const blink::WebScreenInfo& screen_info) { 1156 const blink::WebScreenInfo& screen_info,
1157 const FrameReplicationState& remote_frame_state) {
1146 DCHECK(routing_id != MSG_ROUTING_NONE); 1158 DCHECK(routing_id != MSG_ROUTING_NONE);
1147 RenderViewImplParams params(opener_id, 1159 RenderViewImplParams params(opener_id,
1148 window_was_created_with_opener, 1160 window_was_created_with_opener,
1149 renderer_prefs, 1161 renderer_prefs,
1150 webkit_prefs, 1162 webkit_prefs,
1151 routing_id, 1163 routing_id,
1152 main_frame_routing_id, 1164 main_frame_routing_id,
1153 surface_id, 1165 surface_id,
1154 session_storage_namespace_id, 1166 session_storage_namespace_id,
1155 frame_name, 1167 frame_name,
1156 is_renderer_created, 1168 is_renderer_created,
1157 swapped_out, 1169 swapped_out,
1158 proxy_routing_id, 1170 proxy_routing_id,
1159 hidden, 1171 hidden,
1160 never_visible, 1172 never_visible,
1161 next_page_id, 1173 next_page_id,
1162 screen_info); 1174 screen_info,
1175 remote_frame_state);
1163 RenderViewImpl* render_view = NULL; 1176 RenderViewImpl* render_view = NULL;
1164 if (g_create_render_view_impl) 1177 if (g_create_render_view_impl)
1165 render_view = g_create_render_view_impl(&params); 1178 render_view = g_create_render_view_impl(&params);
1166 else 1179 else
1167 render_view = new RenderViewImpl(&params); 1180 render_view = new RenderViewImpl(&params);
1168 1181
1169 render_view->Initialize(&params); 1182 render_view->Initialize(&params);
1170 return render_view; 1183 return render_view;
1171 } 1184 }
1172 1185
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
1686 main_frame_routing_id, 1699 main_frame_routing_id,
1687 surface_id, 1700 surface_id,
1688 cloned_session_storage_namespace_id, 1701 cloned_session_storage_namespace_id,
1689 base::string16(), // WebCore will take care of setting the correct name. 1702 base::string16(), // WebCore will take care of setting the correct name.
1690 true, // is_renderer_created 1703 true, // is_renderer_created
1691 false, // swapped_out 1704 false, // swapped_out
1692 MSG_ROUTING_NONE, // proxy_routing_id 1705 MSG_ROUTING_NONE, // proxy_routing_id
1693 params.disposition == NEW_BACKGROUND_TAB, // hidden 1706 params.disposition == NEW_BACKGROUND_TAB, // hidden
1694 never_visible, 1707 never_visible,
1695 1, // next_page_id 1708 1, // next_page_id
1696 screen_info_); 1709 screen_info_,
1710 FrameReplicationState()); // empty since swapped_out is false
1697 view->opened_by_user_gesture_ = params.user_gesture; 1711 view->opened_by_user_gesture_ = params.user_gesture;
1698 1712
1699 // Record whether the creator frame is trying to suppress the opener field. 1713 // Record whether the creator frame is trying to suppress the opener field.
1700 view->opener_suppressed_ = params.opener_suppressed; 1714 view->opener_suppressed_ = params.opener_suppressed;
1701 1715
1702 return view->webview(); 1716 return view->webview();
1703 } 1717 }
1704 1718
1705 WebWidget* RenderViewImpl::createPopupMenu(blink::WebPopupType popup_type) { 1719 WebWidget* RenderViewImpl::createPopupMenu(blink::WebPopupType popup_type) {
1706 RenderWidget* widget = 1720 RenderWidget* widget =
(...skipping 2513 matching lines...) Expand 10 before | Expand all | Expand 10 after
4220 std::vector<gfx::Size> sizes; 4234 std::vector<gfx::Size> sizes;
4221 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); 4235 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes);
4222 if (!url.isEmpty()) 4236 if (!url.isEmpty())
4223 urls.push_back( 4237 urls.push_back(
4224 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); 4238 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes));
4225 } 4239 }
4226 SendUpdateFaviconURL(urls); 4240 SendUpdateFaviconURL(urls);
4227 } 4241 }
4228 4242
4229 } // namespace content 4243 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698