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 2025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2036 OpenURL(frame, url, referrer, default_policy); | 2036 OpenURL(frame, url, referrer, default_policy); |
2037 return WebKit::WebNavigationPolicyIgnore; // Suppress the load here. | 2037 return WebKit::WebNavigationPolicyIgnore; // Suppress the load here. |
2038 } | 2038 } |
2039 | 2039 |
2040 // Detect when we're crossing a permission-based boundary (e.g. into or out of | 2040 // Detect when we're crossing a permission-based boundary (e.g. into or out of |
2041 // an extension or app origin, leaving a WebUI page, etc). We only care about | 2041 // an extension or app origin, leaving a WebUI page, etc). We only care about |
2042 // top-level navigations within the current tab (as opposed to, for example, | 2042 // top-level navigations within the current tab (as opposed to, for example, |
2043 // opening a new window). But we sometimes navigate to about:blank to clear a | 2043 // opening a new window). But we sometimes navigate to about:blank to clear a |
2044 // tab, and we want to still allow that. | 2044 // tab, and we want to still allow that. |
2045 // | 2045 // |
2046 // Note: navigating to a new chrome:// scheme from within a chrome:// page | |
2047 // must be a browser navigation so that the browser can first register the | |
2048 // new associated data source. | |
2049 // | |
2046 // Note: we do this only for GET requests because our mechanism for switching | 2050 // Note: we do this only for GET requests because our mechanism for switching |
2047 // processes only issues GET requests. In particular, POST requests don't | 2051 // processes only issues GET requests. In particular, POST requests don't |
2048 // work, because this mechanism does not preserve form POST data. If it | 2052 // work, because this mechanism does not preserve form POST data. If it |
2049 // becomes necessary to support process switching for POST requests, we will | 2053 // becomes necessary to support process switching for POST requests, we will |
2050 // need to send the request's httpBody data up to the browser process, and | 2054 // need to send the request's httpBody data up to the browser process, and |
2051 // issue a special POST navigation in WebKit (via | 2055 // issue a special POST navigation in WebKit (via |
2052 // FrameLoader::loadFrameRequest). See ResourceDispatcher and WebURLLoaderImpl | 2056 // FrameLoader::loadFrameRequest). See ResourceDispatcher and WebURLLoaderImpl |
2053 // for examples of how to send the httpBody data. | 2057 // for examples of how to send the httpBody data. |
2054 // Note2: We normally don't do this for browser-initiated navigations, since | 2058 // Note2: We normally don't do this for browser-initiated navigations, since |
2055 // it's pointless to tell the browser about navigations it gave us. But | 2059 // it's pointless to tell the browser about navigations it gave us. But |
2056 // we do potentially ask the browser to handle a redirect that was originally | 2060 // we do potentially ask the browser to handle a redirect that was originally |
2057 // initiated by the browser. See http://crbug.com/70943 | 2061 // initiated by the browser. See http://crbug.com/70943 |
2058 // | 2062 // |
2059 // TODO(creis): Move this redirect check to the browser process to avoid | 2063 // TODO(creis): Move this redirect check to the browser process to avoid |
2060 // ping-ponging. See http://crbug.com/72380. | 2064 // ping-ponging. See http://crbug.com/72380. |
2061 if (!frame->parent() && (is_content_initiated || is_redirect) && | 2065 if (!frame->parent() && (is_content_initiated || is_redirect) && |
2062 default_policy == WebKit::WebNavigationPolicyCurrentTab && | 2066 default_policy == WebKit::WebNavigationPolicyCurrentTab && |
2063 request.httpMethod() == "GET" && !url.SchemeIs(chrome::kAboutScheme)) { | 2067 request.httpMethod() == "GET" && !url.SchemeIs(chrome::kAboutScheme)) { |
2064 bool send_referrer = false; | 2068 bool send_referrer = false; |
2065 bool should_fork = | 2069 bool should_fork = |
2066 (enabled_bindings_ & content::BINDINGS_POLICY_WEB_UI) || | 2070 (enabled_bindings_ & content::BINDINGS_POLICY_WEB_UI) || |
2067 frame->isViewSourceModeEnabled() || | 2071 frame->isViewSourceModeEnabled() || |
2068 url.SchemeIs(chrome::kViewSourceScheme); | 2072 url.SchemeIs(chrome::kViewSourceScheme) || |
2073 url.SchemeIs("chrome"); | |
jam
2011/12/02 02:29:19
nit: i assume there's a constant somewhere for "ch
| |
2069 | 2074 |
2070 if (!should_fork) { | 2075 if (!should_fork) { |
2071 // Give the embedder a chance. | 2076 // Give the embedder a chance. |
2072 bool is_initial_navigation = page_id_ == -1; | 2077 bool is_initial_navigation = page_id_ == -1; |
2073 should_fork = content::GetContentClient()->renderer()->ShouldFork( | 2078 should_fork = content::GetContentClient()->renderer()->ShouldFork( |
2074 frame, url, is_content_initiated, is_initial_navigation, | 2079 frame, url, is_content_initiated, is_initial_navigation, |
2075 &send_referrer); | 2080 &send_referrer); |
2076 } | 2081 } |
2077 | 2082 |
2078 if (should_fork) { | 2083 if (should_fork) { |
(...skipping 2673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4752 return !!RenderThreadImpl::current()->compositor_thread(); | 4757 return !!RenderThreadImpl::current()->compositor_thread(); |
4753 } | 4758 } |
4754 | 4759 |
4755 void RenderViewImpl::OnJavaBridgeInit( | 4760 void RenderViewImpl::OnJavaBridgeInit( |
4756 const IPC::ChannelHandle& channel_handle) { | 4761 const IPC::ChannelHandle& channel_handle) { |
4757 DCHECK(!java_bridge_dispatcher_.get()); | 4762 DCHECK(!java_bridge_dispatcher_.get()); |
4758 #if defined(ENABLE_JAVA_BRIDGE) | 4763 #if defined(ENABLE_JAVA_BRIDGE) |
4759 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle)); | 4764 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle)); |
4760 #endif | 4765 #endif |
4761 } | 4766 } |
OLD | NEW |