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

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: Addressed creis@ comments. 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 | « no previous file | 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 3020 matching lines...) Expand 10 before | Expand all | Expand 10 after
3031 // POST requests don't work because this mechanism does not preserve form 3031 // POST requests don't work because this mechanism does not preserve form
3032 // POST data. We will need to send the request's httpBody data up to the 3032 // POST data. We will need to send the request's httpBody data up to the
3033 // browser process, and issue a special POST navigation in WebKit (via 3033 // browser process, and issue a special POST navigation in WebKit (via
3034 // FrameLoader::loadFrameRequest). See ResourceDispatcher and WebURLLoaderImpl 3034 // FrameLoader::loadFrameRequest). See ResourceDispatcher and WebURLLoaderImpl
3035 // for examples of how to send the httpBody data. 3035 // for examples of how to send the httpBody data.
3036 if (!frame->parent() && is_content_initiated && 3036 if (!frame->parent() && is_content_initiated &&
3037 !url.SchemeIs(chrome::kAboutScheme)) { 3037 !url.SchemeIs(chrome::kAboutScheme)) {
3038 bool send_referrer = false; 3038 bool send_referrer = false;
3039 3039
3040 // All navigations to WebUI URLs or within WebUI-enabled RenderProcesses 3040 // All navigations to WebUI URLs or within WebUI-enabled RenderProcesses
3041 // must be handled by the browser process so that the correct bindings and 3041 // or from WebUI URLs must be handled by the browser process so that the
3042 // data sources can be registered. 3042 // correct bindings and data sources can be registered.
3043 // Similarly, navigations to view-source URLs or within ViewSource mode 3043 // Similarly, navigations to view-source URLs or within ViewSource mode
3044 // must be handled by the browser process (except for reloads - those are 3044 // must be handled by the browser process (except for reloads - those are
3045 // safe to leave within the renderer). 3045 // safe to leave within the renderer).
3046 // Lastly, access to file:// URLs from non-file:// URL pages must be 3046 // Lastly, access to file:// URLs from non-file:// URL pages must be
3047 // handled by the browser so that ordinary renderer processes don't get 3047 // handled by the browser so that ordinary renderer processes don't get
3048 // blessed with file permissions. 3048 // blessed with file permissions.
3049 int cumulative_bindings = RenderProcess::current()->GetEnabledBindings(); 3049 int cumulative_bindings = RenderProcess::current()->GetEnabledBindings();
3050 bool is_initial_navigation = page_id_ == -1; 3050 bool is_initial_navigation = page_id_ == -1;
3051 bool should_fork = HasWebUIScheme(url) || 3051 bool should_fork = HasWebUIScheme(url) ||
3052 (cumulative_bindings & BINDINGS_POLICY_WEB_UI) || 3052 (cumulative_bindings & BINDINGS_POLICY_WEB_UI) ||
3053 HasWebUIScheme(old_url) ||
Charlie Reis 2013/03/06 19:24:27 nit: Please move above previous line, so that the
3053 url.SchemeIs(chrome::kViewSourceScheme) || 3054 url.SchemeIs(chrome::kViewSourceScheme) ||
3054 (frame->isViewSourceModeEnabled() && 3055 (frame->isViewSourceModeEnabled() &&
3055 type != WebKit::WebNavigationTypeReload); 3056 type != WebKit::WebNavigationTypeReload);
3056 3057
3057 if (!should_fork && url.SchemeIs(chrome::kFileScheme)) { 3058 if (!should_fork && url.SchemeIs(chrome::kFileScheme)) {
3058 // Fork non-file to file opens. Check the opener URL if this is the 3059 // Fork non-file to file opens. Check the opener URL if this is the
3059 // initial navigation in a newly opened window. 3060 // initial navigation in a newly opened window.
3060 GURL source_url(old_url); 3061 GURL source_url(old_url);
3061 if (is_initial_navigation && source_url.is_empty() && frame->opener()) 3062 if (is_initial_navigation && source_url.is_empty() && frame->opener())
3062 source_url = frame->opener()->top()->document().url(); 3063 source_url = frame->opener()->top()->document().url();
(...skipping 3688 matching lines...) Expand 10 before | Expand all | Expand 10 after
6751 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); 6752 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle);
6752 RenderProcess::current()->ReleaseTransportDIB(dib); 6753 RenderProcess::current()->ReleaseTransportDIB(dib);
6753 } 6754 }
6754 6755
6755 void RenderViewImpl::DidCommitCompositorFrame() { 6756 void RenderViewImpl::DidCommitCompositorFrame() {
6756 RenderWidget::DidCommitCompositorFrame(); 6757 RenderWidget::DidCommitCompositorFrame();
6757 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidCommitCompositorFrame()); 6758 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidCommitCompositorFrame());
6758 } 6759 }
6759 6760
6760 } // namespace content 6761 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698