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 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
679 base::debug::SetCrashKeyValue("rvinit_view_id", | 679 base::debug::SetCrashKeyValue("rvinit_view_id", |
680 base::IntToString(routing_id())); | 680 base::IntToString(routing_id())); |
681 base::debug::SetCrashKeyValue("rvinit_proxy_id", | 681 base::debug::SetCrashKeyValue("rvinit_proxy_id", |
682 base::IntToString(params.proxy_routing_id)); | 682 base::IntToString(params.proxy_routing_id)); |
683 base::debug::SetCrashKeyValue( | 683 base::debug::SetCrashKeyValue( |
684 "rvinit_main_frame_id", base::IntToString(params.main_frame_routing_id)); | 684 "rvinit_main_frame_id", base::IntToString(params.main_frame_routing_id)); |
685 | 685 |
686 if (params.main_frame_routing_id != MSG_ROUTING_NONE) { | 686 if (params.main_frame_routing_id != MSG_ROUTING_NONE) { |
687 main_render_frame_ = RenderFrameImpl::CreateMainFrame( | 687 main_render_frame_ = RenderFrameImpl::CreateMainFrame( |
688 this, params.main_frame_routing_id, params.main_frame_widget_routing_id, | 688 this, params.main_frame_routing_id, params.main_frame_widget_routing_id, |
689 params.hidden, screen_info(), compositor_deps_); | 689 params.hidden, screen_info(), compositor_deps_, opener_frame); |
690 } | 690 } |
691 | 691 |
692 if (params.proxy_routing_id != MSG_ROUTING_NONE) { | 692 if (params.proxy_routing_id != MSG_ROUTING_NONE) { |
693 CHECK(params.swapped_out); | 693 CHECK(params.swapped_out); |
694 if (main_render_frame_) { | 694 if (main_render_frame_) { |
695 CHECK(!SiteIsolationPolicy::IsSwappedOutStateForbidden()); | 695 CHECK(!SiteIsolationPolicy::IsSwappedOutStateForbidden()); |
696 RenderFrameProxy* proxy = RenderFrameProxy::CreateProxyToReplaceFrame( | 696 RenderFrameProxy* proxy = RenderFrameProxy::CreateProxyToReplaceFrame( |
697 main_render_frame_, params.proxy_routing_id, | 697 main_render_frame_, params.proxy_routing_id, |
698 blink::WebTreeScopeType::Document); | 698 blink::WebTreeScopeType::Document); |
699 main_render_frame_->set_render_frame_proxy(proxy); | 699 main_render_frame_->set_render_frame_proxy(proxy); |
700 } else { | 700 } else { |
701 CHECK(SiteIsolationPolicy::IsSwappedOutStateForbidden()); | 701 CHECK(SiteIsolationPolicy::IsSwappedOutStateForbidden()); |
702 // Pass MSG_ROUTING_NONE for opener, since actual opener (if any) will be | 702 RenderFrameProxy::CreateFrameProxy( |
703 // set separately below. | 703 params.proxy_routing_id, routing_id(), params.opener_frame_route_id, |
704 RenderFrameProxy::CreateFrameProxy(params.proxy_routing_id, routing_id(), | 704 MSG_ROUTING_NONE, params.replicated_frame_state); |
705 MSG_ROUTING_NONE, MSG_ROUTING_NONE, | |
706 params.replicated_frame_state); | |
707 } | 705 } |
708 } | 706 } |
709 | 707 |
710 if (main_render_frame_) | 708 if (main_render_frame_) |
711 main_render_frame_->Initialize(); | 709 main_render_frame_->Initialize(); |
712 | 710 |
713 #if defined(OS_ANDROID) | 711 #if defined(OS_ANDROID) |
714 content_detectors_.push_back(make_scoped_ptr(new AddressDetector())); | 712 content_detectors_.push_back(make_scoped_ptr(new AddressDetector())); |
715 const std::string& contry_iso = | 713 const std::string& contry_iso = |
716 params.renderer_preferences.network_contry_iso; | 714 params.renderer_preferences.network_contry_iso; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
799 new IdleUserDetector(this); | 797 new IdleUserDetector(this); |
800 | 798 |
801 if (command_line.HasSwitch(switches::kDomAutomationController)) | 799 if (command_line.HasSwitch(switches::kDomAutomationController)) |
802 enabled_bindings_ |= BINDINGS_POLICY_DOM_AUTOMATION; | 800 enabled_bindings_ |= BINDINGS_POLICY_DOM_AUTOMATION; |
803 if (command_line.HasSwitch(switches::kStatsCollectionController)) | 801 if (command_line.HasSwitch(switches::kStatsCollectionController)) |
804 enabled_bindings_ |= BINDINGS_POLICY_STATS_COLLECTION; | 802 enabled_bindings_ |= BINDINGS_POLICY_STATS_COLLECTION; |
805 | 803 |
806 GetContentClient()->renderer()->RenderViewCreated(this); | 804 GetContentClient()->renderer()->RenderViewCreated(this); |
807 | 805 |
808 // If we have an opener_frame but we weren't created by a renderer, then it's | 806 // If we have an opener_frame but we weren't created by a renderer, then it's |
809 // the browser asking us to set our opener to another frame. | 807 // the browser asking us to set our opener to another frame. |
alexmos
2016/02/26 19:55:34
You might want to update this comment, since we do
dcheng
2016/02/26 22:52:29
Hmm... what would you suggest for this comment? It
alexmos
2016/02/26 23:54:47
I just thought it was confusing that it talks abou
dcheng
2016/02/27 01:41:21
Done. I also collapsed the two if blocks together.
| |
810 if (opener_frame && !was_created_by_renderer) { | 808 if (opener_frame && !was_created_by_renderer) { |
811 webview()->mainFrame()->setOpener(opener_frame); | |
812 | |
813 // Ensure that sandbox flags are inherited from an opener in a different | 809 // Ensure that sandbox flags are inherited from an opener in a different |
Charlie Reis
2016/02/25 01:08:08
I'm wondering if the rest of this block needs any
dcheng
2016/02/25 01:13:28
Maybe… but this patch has affected a lot more plum
Charlie Reis
2016/02/25 21:21:25
Separate patch is fine. Just wanted to raise the
alexmos
2016/02/26 19:55:34
Yes, this is specific to the main frame (the scena
dcheng
2016/02/27 01:41:21
createWindow() doesn't *always* create a new windo
| |
814 // process. In that case, the browser process will set any inherited | 810 // process. In that case, the browser process will set any inherited |
815 // sandbox flags in |replicated_frame_state|, so apply them here. | 811 // sandbox flags in |replicated_frame_state|, so apply them here. |
816 if (webview()->mainFrame()->isWebLocalFrame()) { | 812 if (webview()->mainFrame()->isWebLocalFrame()) { |
817 webview()->mainFrame()->toWebLocalFrame()->forceSandboxFlags( | 813 webview()->mainFrame()->toWebLocalFrame()->forceSandboxFlags( |
818 params.replicated_frame_state.sandbox_flags); | 814 params.replicated_frame_state.sandbox_flags); |
819 } | 815 } |
820 } | 816 } |
821 | 817 |
822 // If we are initially swapped out, navigate to kSwappedOutURL. | 818 // If we are initially swapped out, navigate to kSwappedOutURL. |
823 // This ensures we are in a unique origin that others cannot script. | 819 // This ensures we are in a unique origin that others cannot script. |
(...skipping 2723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3547 if (IsUseZoomForDSFEnabled()) { | 3543 if (IsUseZoomForDSFEnabled()) { |
3548 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); | 3544 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); |
3549 } else { | 3545 } else { |
3550 webview()->setDeviceScaleFactor(device_scale_factor_); | 3546 webview()->setDeviceScaleFactor(device_scale_factor_); |
3551 } | 3547 } |
3552 webview()->settings()->setPreferCompositingToLCDTextEnabled( | 3548 webview()->settings()->setPreferCompositingToLCDTextEnabled( |
3553 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); | 3549 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); |
3554 } | 3550 } |
3555 | 3551 |
3556 } // namespace content | 3552 } // namespace content |
OLD | NEW |