Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 12531004: Let the browser handle external navigations from DevTools. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added a test Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/devtools/devtools_sanity_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3022 matching lines...) Expand 10 before | Expand all | Expand 10 after
3033 // security than loading a WebUI, extension or app page in the wrong process. 3033 // security than loading a WebUI, extension or app page in the wrong process.
3034 // POST requests don't work because this mechanism does not preserve form 3034 // POST requests don't work because this mechanism does not preserve form
3035 // POST data. We will need to send the request's httpBody data up to the 3035 // POST data. We will need to send the request's httpBody data up to the
3036 // browser process, and issue a special POST navigation in WebKit (via 3036 // browser process, and issue a special POST navigation in WebKit (via
3037 // FrameLoader::loadFrameRequest). See ResourceDispatcher and WebURLLoaderImpl 3037 // FrameLoader::loadFrameRequest). See ResourceDispatcher and WebURLLoaderImpl
3038 // for examples of how to send the httpBody data. 3038 // for examples of how to send the httpBody data.
3039 if (!frame->parent() && is_content_initiated && 3039 if (!frame->parent() && is_content_initiated &&
3040 !url.SchemeIs(chrome::kAboutScheme)) { 3040 !url.SchemeIs(chrome::kAboutScheme)) {
3041 bool send_referrer = false; 3041 bool send_referrer = false;
3042 3042
3043 // All navigations to WebUI URLs or within WebUI-enabled RenderProcesses 3043 // All navigations to or from WebUI URLs or within WebUI-enabled
3044 // must be handled by the browser process so that the correct bindings and 3044 // RenderProcesses must be handled by the browser process so that the
3045 // data sources can be registered. 3045 // correct bindings and data sources can be registered.
3046 // Similarly, navigations to view-source URLs or within ViewSource mode 3046 // Similarly, navigations to view-source URLs or within ViewSource mode
3047 // must be handled by the browser process (except for reloads - those are 3047 // must be handled by the browser process (except for reloads - those are
3048 // safe to leave within the renderer). 3048 // safe to leave within the renderer).
3049 // Lastly, access to file:// URLs from non-file:// URL pages must be 3049 // Lastly, access to file:// URLs from non-file:// URL pages must be
3050 // handled by the browser so that ordinary renderer processes don't get 3050 // handled by the browser so that ordinary renderer processes don't get
3051 // blessed with file permissions. 3051 // blessed with file permissions.
3052 int cumulative_bindings = RenderProcess::current()->GetEnabledBindings(); 3052 int cumulative_bindings = RenderProcess::current()->GetEnabledBindings();
3053 bool is_initial_navigation = page_id_ == -1; 3053 bool is_initial_navigation = page_id_ == -1;
3054 bool should_fork = HasWebUIScheme(url) || 3054 bool should_fork = HasWebUIScheme(url) || HasWebUIScheme(old_url) ||
3055 (cumulative_bindings & BINDINGS_POLICY_WEB_UI) || 3055 (cumulative_bindings & BINDINGS_POLICY_WEB_UI) ||
3056 url.SchemeIs(chrome::kViewSourceScheme) || 3056 url.SchemeIs(chrome::kViewSourceScheme) ||
3057 (frame->isViewSourceModeEnabled() && 3057 (frame->isViewSourceModeEnabled() &&
3058 type != WebKit::WebNavigationTypeReload); 3058 type != WebKit::WebNavigationTypeReload);
3059 3059
3060 if (!should_fork && url.SchemeIs(chrome::kFileScheme)) { 3060 if (!should_fork && url.SchemeIs(chrome::kFileScheme)) {
3061 // Fork non-file to file opens. Check the opener URL if this is the 3061 // Fork non-file to file opens. Check the opener URL if this is the
3062 // initial navigation in a newly opened window. 3062 // initial navigation in a newly opened window.
3063 GURL source_url(old_url); 3063 GURL source_url(old_url);
3064 if (is_initial_navigation && source_url.is_empty() && frame->opener()) 3064 if (is_initial_navigation && source_url.is_empty() && frame->opener())
(...skipping 3687 matching lines...) Expand 10 before | Expand all | Expand 10 after
6752 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); 6752 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle);
6753 RenderProcess::current()->ReleaseTransportDIB(dib); 6753 RenderProcess::current()->ReleaseTransportDIB(dib);
6754 } 6754 }
6755 6755
6756 void RenderViewImpl::DidCommitCompositorFrame() { 6756 void RenderViewImpl::DidCommitCompositorFrame() {
6757 RenderWidget::DidCommitCompositorFrame(); 6757 RenderWidget::DidCommitCompositorFrame();
6758 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidCommitCompositorFrame()); 6758 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidCommitCompositorFrame());
6759 } 6759 }
6760 6760
6761 } // namespace content 6761 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/devtools/devtools_sanity_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698