OLD | NEW |
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/browser/renderer_host/render_view_host_impl.h" | 5 #include "content/browser/renderer_host/render_view_host_impl.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 next_page_id = max_page_id + 1; | 307 next_page_id = max_page_id + 1; |
308 | 308 |
309 ViewMsg_New_Params params; | 309 ViewMsg_New_Params params; |
310 params.renderer_preferences = | 310 params.renderer_preferences = |
311 delegate_->GetRendererPrefs(GetProcess()->GetBrowserContext()); | 311 delegate_->GetRendererPrefs(GetProcess()->GetBrowserContext()); |
312 #if defined(OS_WIN) | 312 #if defined(OS_WIN) |
313 GetWindowsSpecificPrefs(¶ms.renderer_preferences); | 313 GetWindowsSpecificPrefs(¶ms.renderer_preferences); |
314 #endif | 314 #endif |
315 params.web_preferences = GetWebkitPreferences(); | 315 params.web_preferences = GetWebkitPreferences(); |
316 params.view_id = GetRoutingID(); | 316 params.view_id = GetRoutingID(); |
| 317 params.view_surface_id = surface_id(); |
317 params.main_frame_routing_id = main_frame_routing_id_; | 318 params.main_frame_routing_id = main_frame_routing_id_; |
318 params.surface_id = surface_id(); | 319 if (main_frame_routing_id_ != MSG_ROUTING_NONE) { |
| 320 RenderFrameHostImpl* main_rfh = RenderFrameHostImpl::FromID( |
| 321 GetProcess()->GetID(), main_frame_routing_id_); |
| 322 DCHECK(main_rfh); |
| 323 RenderWidgetHostImpl* main_rwh = main_rfh->GetRenderWidgetHostForFrame(); |
| 324 params.main_frame_widget_routing_id = main_rwh->GetRoutingID(); |
| 325 params.widget_surface_id = main_rwh->surface_id(); |
| 326 } |
319 params.session_storage_namespace_id = | 327 params.session_storage_namespace_id = |
320 delegate_->GetSessionStorageNamespace(instance_.get())->id(); | 328 delegate_->GetSessionStorageNamespace(instance_.get())->id(); |
321 // Ensure the RenderView sets its opener correctly. | 329 // Ensure the RenderView sets its opener correctly. |
322 params.opener_frame_route_id = opener_frame_route_id; | 330 params.opener_frame_route_id = opener_frame_route_id; |
323 params.swapped_out = !is_active_; | 331 params.swapped_out = !is_active_; |
324 params.replicated_frame_state = replicated_frame_state; | 332 params.replicated_frame_state = replicated_frame_state; |
325 params.proxy_routing_id = proxy_route_id; | 333 params.proxy_routing_id = proxy_route_id; |
326 params.hidden = is_hidden(); | 334 params.hidden = is_hidden(); |
327 params.never_visible = delegate_->IsNeverVisible(); | 335 params.never_visible = delegate_->IsNeverVisible(); |
328 params.window_was_created_with_opener = window_was_created_with_opener; | 336 params.window_was_created_with_opener = window_was_created_with_opener; |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 | 751 |
744 // Ensure we aren't granting WebUI bindings to a process that has already | 752 // Ensure we aren't granting WebUI bindings to a process that has already |
745 // been used for non-privileged views. | 753 // been used for non-privileged views. |
746 if (bindings_flags & BINDINGS_POLICY_WEB_UI && | 754 if (bindings_flags & BINDINGS_POLICY_WEB_UI && |
747 GetProcess()->HasConnection() && | 755 GetProcess()->HasConnection() && |
748 !ChildProcessSecurityPolicyImpl::GetInstance()->HasWebUIBindings( | 756 !ChildProcessSecurityPolicyImpl::GetInstance()->HasWebUIBindings( |
749 GetProcess()->GetID())) { | 757 GetProcess()->GetID())) { |
750 // This process has no bindings yet. Make sure it does not have more | 758 // This process has no bindings yet. Make sure it does not have more |
751 // than this single active view. | 759 // than this single active view. |
752 // --single-process only has one renderer. | 760 // --single-process only has one renderer. |
753 if (GetProcess()->GetActiveViewCount() > 1 && | 761 // TODO(dcheng): IMPORTANT IMPORTANT IMPORTANT. Once RenderViewHost is no |
| 762 // longer a RenderWidgetHost, this *must* be decremented back to 1. |
| 763 if (GetProcess()->GetActiveViewCount() > 2 && |
754 !base::CommandLine::ForCurrentProcess()->HasSwitch( | 764 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
755 switches::kSingleProcess)) | 765 switches::kSingleProcess)) |
756 return; | 766 return; |
757 } | 767 } |
758 | 768 |
759 if (bindings_flags & BINDINGS_POLICY_WEB_UI) { | 769 if (bindings_flags & BINDINGS_POLICY_WEB_UI) { |
760 ChildProcessSecurityPolicyImpl::GetInstance()->GrantWebUIBindings( | 770 ChildProcessSecurityPolicyImpl::GetInstance()->GrantWebUIBindings( |
761 GetProcess()->GetID()); | 771 GetProcess()->GetID()); |
762 } | 772 } |
763 | 773 |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
977 } | 987 } |
978 | 988 |
979 RenderWidgetHostImpl::WasShown(latency_info); | 989 RenderWidgetHostImpl::WasShown(latency_info); |
980 } | 990 } |
981 | 991 |
982 bool RenderViewHostImpl::IsRenderView() const { | 992 bool RenderViewHostImpl::IsRenderView() const { |
983 return true; | 993 return true; |
984 } | 994 } |
985 | 995 |
986 void RenderViewHostImpl::CreateNewWindow( | 996 void RenderViewHostImpl::CreateNewWindow( |
987 int route_id, | 997 int32 route_id, |
988 int main_frame_route_id, | 998 int32 main_frame_route_id, |
| 999 int32 main_frame_widget_route_id, |
| 1000 int32 surface_id, |
989 const ViewHostMsg_CreateWindow_Params& params, | 1001 const ViewHostMsg_CreateWindow_Params& params, |
990 SessionStorageNamespace* session_storage_namespace) { | 1002 SessionStorageNamespace* session_storage_namespace) { |
991 ViewHostMsg_CreateWindow_Params validated_params(params); | 1003 ViewHostMsg_CreateWindow_Params validated_params(params); |
992 GetProcess()->FilterURL(false, &validated_params.target_url); | 1004 GetProcess()->FilterURL(false, &validated_params.target_url); |
993 GetProcess()->FilterURL(false, &validated_params.opener_url); | 1005 GetProcess()->FilterURL(false, &validated_params.opener_url); |
994 GetProcess()->FilterURL(true, &validated_params.opener_security_origin); | 1006 GetProcess()->FilterURL(true, &validated_params.opener_security_origin); |
995 | 1007 |
996 delegate_->CreateNewWindow(GetSiteInstance(), route_id, main_frame_route_id, | 1008 delegate_->CreateNewWindow(GetSiteInstance(), route_id, main_frame_route_id, |
| 1009 main_frame_widget_route_id, surface_id, |
997 validated_params, session_storage_namespace); | 1010 validated_params, session_storage_namespace); |
998 } | 1011 } |
999 | 1012 |
1000 void RenderViewHostImpl::CreateNewWidget(int32 route_id, | 1013 void RenderViewHostImpl::CreateNewWidget(int32 route_id, |
1001 int32 surface_id, | 1014 int32 surface_id, |
1002 blink::WebPopupType popup_type) { | 1015 blink::WebPopupType popup_type) { |
1003 delegate_->CreateNewWidget(GetProcess()->GetID(), route_id, surface_id, | 1016 delegate_->CreateNewWidget(GetProcess()->GetID(), route_id, surface_id, |
1004 popup_type); | 1017 popup_type); |
1005 } | 1018 } |
1006 | 1019 |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1430 if (!policy->CanReadFile(GetProcess()->GetID(), file)) | 1443 if (!policy->CanReadFile(GetProcess()->GetID(), file)) |
1431 policy->GrantReadFile(GetProcess()->GetID(), file); | 1444 policy->GrantReadFile(GetProcess()->GetID(), file); |
1432 } | 1445 } |
1433 } | 1446 } |
1434 | 1447 |
1435 void RenderViewHostImpl::SelectWordAroundCaret() { | 1448 void RenderViewHostImpl::SelectWordAroundCaret() { |
1436 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); | 1449 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); |
1437 } | 1450 } |
1438 | 1451 |
1439 } // namespace content | 1452 } // namespace content |
OLD | NEW |