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/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 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 base::debug::SetCrashKeyValue("rvinit_view_id", | 680 base::debug::SetCrashKeyValue("rvinit_view_id", |
681 base::IntToString(routing_id())); | 681 base::IntToString(routing_id())); |
682 base::debug::SetCrashKeyValue("rvinit_proxy_id", | 682 base::debug::SetCrashKeyValue("rvinit_proxy_id", |
683 base::IntToString(params.proxy_routing_id)); | 683 base::IntToString(params.proxy_routing_id)); |
684 base::debug::SetCrashKeyValue( | 684 base::debug::SetCrashKeyValue( |
685 "rvinit_main_frame_id", base::IntToString(params.main_frame_routing_id)); | 685 "rvinit_main_frame_id", base::IntToString(params.main_frame_routing_id)); |
686 | 686 |
687 if (params.main_frame_routing_id != MSG_ROUTING_NONE) { | 687 if (params.main_frame_routing_id != MSG_ROUTING_NONE) { |
688 main_render_frame_ = RenderFrameImpl::CreateMainFrame( | 688 main_render_frame_ = RenderFrameImpl::CreateMainFrame( |
689 this, params.main_frame_routing_id, params.main_frame_widget_routing_id, | 689 this, params.main_frame_routing_id, params.main_frame_widget_routing_id, |
690 params.hidden, screen_info(), compositor_deps_); | 690 params.hidden, screen_info(), compositor_deps_, opener_frame); |
691 } | 691 } |
692 | 692 |
693 if (params.proxy_routing_id != MSG_ROUTING_NONE) { | 693 if (params.proxy_routing_id != MSG_ROUTING_NONE) { |
694 CHECK(params.swapped_out); | 694 CHECK(params.swapped_out); |
695 if (main_render_frame_) { | 695 if (main_render_frame_) { |
696 CHECK(!SiteIsolationPolicy::IsSwappedOutStateForbidden()); | 696 CHECK(!SiteIsolationPolicy::IsSwappedOutStateForbidden()); |
697 RenderFrameProxy* proxy = RenderFrameProxy::CreateProxyToReplaceFrame( | 697 RenderFrameProxy* proxy = RenderFrameProxy::CreateProxyToReplaceFrame( |
698 main_render_frame_, params.proxy_routing_id, | 698 main_render_frame_, params.proxy_routing_id, |
699 blink::WebTreeScopeType::Document); | 699 blink::WebTreeScopeType::Document); |
700 main_render_frame_->set_render_frame_proxy(proxy); | 700 main_render_frame_->set_render_frame_proxy(proxy); |
701 } else { | 701 } else { |
702 CHECK(SiteIsolationPolicy::IsSwappedOutStateForbidden()); | 702 CHECK(SiteIsolationPolicy::IsSwappedOutStateForbidden()); |
703 // Pass MSG_ROUTING_NONE for opener, since actual opener (if any) will be | 703 RenderFrameProxy::CreateFrameProxy( |
704 // set separately below. | 704 params.proxy_routing_id, routing_id(), params.opener_frame_route_id, |
705 RenderFrameProxy::CreateFrameProxy(params.proxy_routing_id, routing_id(), | 705 MSG_ROUTING_NONE, params.replicated_frame_state); |
706 MSG_ROUTING_NONE, MSG_ROUTING_NONE, | |
707 params.replicated_frame_state); | |
708 } | 706 } |
709 } | 707 } |
710 | 708 |
711 if (main_render_frame_) | 709 if (main_render_frame_) |
712 main_render_frame_->Initialize(); | 710 main_render_frame_->Initialize(); |
713 | 711 |
714 #if defined(OS_ANDROID) | 712 #if defined(OS_ANDROID) |
715 content_detectors_.push_back(make_scoped_ptr(new AddressDetector())); | 713 content_detectors_.push_back(make_scoped_ptr(new AddressDetector())); |
716 const std::string& contry_iso = | 714 const std::string& contry_iso = |
717 params.renderer_preferences.network_contry_iso; | 715 params.renderer_preferences.network_contry_iso; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 | 797 |
800 new IdleUserDetector(this); | 798 new IdleUserDetector(this); |
801 | 799 |
802 if (command_line.HasSwitch(switches::kDomAutomationController)) | 800 if (command_line.HasSwitch(switches::kDomAutomationController)) |
803 enabled_bindings_ |= BINDINGS_POLICY_DOM_AUTOMATION; | 801 enabled_bindings_ |= BINDINGS_POLICY_DOM_AUTOMATION; |
804 if (command_line.HasSwitch(switches::kStatsCollectionController)) | 802 if (command_line.HasSwitch(switches::kStatsCollectionController)) |
805 enabled_bindings_ |= BINDINGS_POLICY_STATS_COLLECTION; | 803 enabled_bindings_ |= BINDINGS_POLICY_STATS_COLLECTION; |
806 | 804 |
807 GetContentClient()->renderer()->RenderViewCreated(this); | 805 GetContentClient()->renderer()->RenderViewCreated(this); |
808 | 806 |
809 // If we have an opener_frame but we weren't created by a renderer, then it's | 807 // Ensure that sandbox flags are inherited from an opener in a different |
810 // the browser asking us to set our opener to another frame. | 808 // process. In that case, the browser process will set any inherited sandbox |
811 if (opener_frame && !was_created_by_renderer) { | 809 // flags in |replicated_frame_state|, so apply them here. |
812 webview()->mainFrame()->setOpener(opener_frame); | 810 if (opener_frame && !was_created_by_renderer && |
813 | 811 webview()->mainFrame()->isWebLocalFrame()) { |
814 // Ensure that sandbox flags are inherited from an opener in a different | 812 webview()->mainFrame()->toWebLocalFrame()->forceSandboxFlags( |
815 // process. In that case, the browser process will set any inherited | 813 params.replicated_frame_state.sandbox_flags); |
816 // sandbox flags in |replicated_frame_state|, so apply them here. | |
817 if (webview()->mainFrame()->isWebLocalFrame()) { | |
818 webview()->mainFrame()->toWebLocalFrame()->forceSandboxFlags( | |
819 params.replicated_frame_state.sandbox_flags); | |
820 } | |
821 } | 814 } |
822 | 815 |
823 // If we are initially swapped out, navigate to kSwappedOutURL. | 816 // If we are initially swapped out, navigate to kSwappedOutURL. |
824 // This ensures we are in a unique origin that others cannot script. | 817 // This ensures we are in a unique origin that others cannot script. |
825 if (is_swapped_out_ && webview()->mainFrame()->isWebLocalFrame()) | 818 if (is_swapped_out_ && webview()->mainFrame()->isWebLocalFrame()) |
826 main_render_frame_->NavigateToSwappedOutURL(); | 819 main_render_frame_->NavigateToSwappedOutURL(); |
827 } | 820 } |
828 | 821 |
829 RenderViewImpl::~RenderViewImpl() { | 822 RenderViewImpl::~RenderViewImpl() { |
830 DCHECK(!frame_widget_); | 823 DCHECK(!frame_widget_); |
(...skipping 2721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3552 if (IsUseZoomForDSFEnabled()) { | 3545 if (IsUseZoomForDSFEnabled()) { |
3553 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); | 3546 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); |
3554 } else { | 3547 } else { |
3555 webview()->setDeviceScaleFactor(device_scale_factor_); | 3548 webview()->setDeviceScaleFactor(device_scale_factor_); |
3556 } | 3549 } |
3557 webview()->settings()->setPreferCompositingToLCDTextEnabled( | 3550 webview()->settings()->setPreferCompositingToLCDTextEnabled( |
3558 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); | 3551 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); |
3559 } | 3552 } |
3560 | 3553 |
3561 } // namespace content | 3554 } // namespace content |
OLD | NEW |