Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 2003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2014 bool is_content_initiated = | 2014 bool is_content_initiated = |
| 2015 NavigationState::FromDataSource(frame->provisionalDataSource())-> | 2015 NavigationState::FromDataSource(frame->provisionalDataSource())-> |
| 2016 is_content_initiated(); | 2016 is_content_initiated(); |
| 2017 | 2017 |
| 2018 // Experimental: | 2018 // Experimental: |
| 2019 // If --enable-strict-site-isolation is enabled, send all top-level | 2019 // If --enable-strict-site-isolation is enabled, send all top-level |
| 2020 // navigations to the browser to let it swap processes when crossing site | 2020 // navigations to the browser to let it swap processes when crossing site |
| 2021 // boundaries. This is currently expected to break some script calls and | 2021 // boundaries. This is currently expected to break some script calls and |
| 2022 // navigations, such as form submissions. | 2022 // navigations, such as form submissions. |
| 2023 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 2023 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 2024 if (!frame->parent() && (is_content_initiated || is_redirect) && | 2024 if (command_line.HasSwitch(switches::kEnableStrictSiteIsolation) && |
| 2025 command_line.HasSwitch(switches::kEnableStrictSiteIsolation)) { | 2025 !frame->parent() && (is_content_initiated || is_redirect)) { |
| 2026 GURL referrer(request.httpHeaderField(WebString::fromUTF8("Referer"))); | 2026 WebString origin_str = frame->document().securityOrigin().toString(); |
| 2027 OpenURL(frame, url, referrer, default_policy); | 2027 GURL frame_url(origin_str.utf8().data()); |
| 2028 return WebKit::WebNavigationPolicyIgnore; | 2028 if (frame_url.GetOrigin() != url.GetOrigin()) { |
|
Charlie Reis
2011/11/10 01:09:26
This doesn't agree with the logic the browser uses
| |
| 2029 GURL referrer(request.httpHeaderField(WebString::fromUTF8("Referer"))); | |
| 2030 OpenURL(frame, url, referrer, default_policy); | |
| 2031 return WebKit::WebNavigationPolicyIgnore; | |
| 2032 } | |
| 2029 } | 2033 } |
| 2030 | 2034 |
| 2031 // If the browser is interested, then give it a chance to look at top level | 2035 // If the browser is interested, then give it a chance to look at top level |
| 2032 // navigations. | 2036 // navigations. |
| 2033 if (is_content_initiated && | 2037 if (is_content_initiated && |
| 2034 renderer_preferences_.browser_handles_top_level_requests && | 2038 renderer_preferences_.browser_handles_top_level_requests && |
| 2035 IsNonLocalTopLevelNavigation(url, frame, type)) { | 2039 IsNonLocalTopLevelNavigation(url, frame, type)) { |
| 2036 GURL referrer(request.httpHeaderField(WebString::fromUTF8("Referer"))); | 2040 GURL referrer(request.httpHeaderField(WebString::fromUTF8("Referer"))); |
| 2037 // Reset these counters as the RenderView could be reused for the next | 2041 // Reset these counters as the RenderView could be reused for the next |
| 2038 // navigation. | 2042 // navigation. |
| (...skipping 2665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4704 return webview()->settings()->useThreadedCompositor(); | 4708 return webview()->settings()->useThreadedCompositor(); |
| 4705 } | 4709 } |
| 4706 | 4710 |
| 4707 void RenderViewImpl::OnJavaBridgeInit( | 4711 void RenderViewImpl::OnJavaBridgeInit( |
| 4708 const IPC::ChannelHandle& channel_handle) { | 4712 const IPC::ChannelHandle& channel_handle) { |
| 4709 DCHECK(!java_bridge_dispatcher_.get()); | 4713 DCHECK(!java_bridge_dispatcher_.get()); |
| 4710 #if defined(ENABLE_JAVA_BRIDGE) | 4714 #if defined(ENABLE_JAVA_BRIDGE) |
| 4711 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle)); | 4715 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle)); |
| 4712 #endif | 4716 #endif |
| 4713 } | 4717 } |
| OLD | NEW |