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

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

Issue 9808029: Prepending view-source: does not load the source of the userscript. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: allow_download_(true) Created 8 years, 7 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
« no previous file with comments | « content/public/renderer/navigation_state.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 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 2676 matching lines...) Expand 10 before | Expand all | Expand 10 after
2687 // initiated any load resulting from JS execution. 2687 // initiated any load resulting from JS execution.
2688 if (!params.url.SchemeIs(chrome::kJavaScriptScheme)) { 2688 if (!params.url.SchemeIs(chrome::kJavaScriptScheme)) {
2689 navigation_state = NavigationState::CreateBrowserInitiated( 2689 navigation_state = NavigationState::CreateBrowserInitiated(
2690 params.page_id, 2690 params.page_id,
2691 params.pending_history_list_offset, 2691 params.pending_history_list_offset,
2692 params.transition); 2692 params.transition);
2693 navigation_state->set_transferred_request_child_id( 2693 navigation_state->set_transferred_request_child_id(
2694 params.transferred_request_child_id); 2694 params.transferred_request_child_id);
2695 navigation_state->set_transferred_request_request_id( 2695 navigation_state->set_transferred_request_request_id(
2696 params.transferred_request_request_id); 2696 params.transferred_request_request_id);
2697 navigation_state->set_allow_download(params.allow_download);
2697 } else { 2698 } else {
2698 navigation_state = NavigationState::CreateContentInitiated(); 2699 navigation_state = NavigationState::CreateContentInitiated();
2699 } 2700 }
2700 return navigation_state; 2701 return navigation_state;
2701 } 2702 }
2702 2703
2703 void RenderViewImpl::ProcessViewLayoutFlags(const CommandLine& command_line) { 2704 void RenderViewImpl::ProcessViewLayoutFlags(const CommandLine& command_line) {
2704 bool enable_viewport = 2705 bool enable_viewport =
2705 command_line.HasSwitch(switches::kEnableViewport) || 2706 command_line.HasSwitch(switches::kEnableViewport) ||
2706 // Setting a default device scale factor forces enable_viewport on. 2707 // Setting a default device scale factor forces enable_viewport on.
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
3098 if (!top_frame) 3099 if (!top_frame)
3099 top_frame = frame; 3100 top_frame = frame;
3100 WebDataSource* provisional_data_source = top_frame->provisionalDataSource(); 3101 WebDataSource* provisional_data_source = top_frame->provisionalDataSource();
3101 WebDataSource* top_data_source = top_frame->dataSource(); 3102 WebDataSource* top_data_source = top_frame->dataSource();
3102 WebDataSource* data_source = 3103 WebDataSource* data_source =
3103 provisional_data_source ? provisional_data_source : top_data_source; 3104 provisional_data_source ? provisional_data_source : top_data_source;
3104 3105
3105 GURL request_url(request.url()); 3106 GURL request_url(request.url());
3106 GURL new_url; 3107 GURL new_url;
3107 if (content::GetContentClient()->renderer()->WillSendRequest( 3108 if (content::GetContentClient()->renderer()->WillSendRequest(
3108 frame, request_url, &new_url)) { 3109 frame, request_url, &new_url)) {
3109 request.setURL(WebURL(new_url)); 3110 request.setURL(WebURL(new_url));
3110 } 3111 }
3111 3112
3112 content::PageTransition transition_type = content::PAGE_TRANSITION_LINK; 3113 content::PageTransition transition_type = content::PAGE_TRANSITION_LINK;
3113 DocumentState* document_state = DocumentState::FromDataSource(data_source); 3114 DocumentState* document_state = DocumentState::FromDataSource(data_source);
3114 NavigationState* navigation_state = document_state->navigation_state(); 3115 NavigationState* navigation_state = document_state->navigation_state();
3115 if (document_state) { 3116 if (document_state) {
3116 if (document_state->is_cache_policy_override_set()) 3117 if (document_state->is_cache_policy_override_set())
3117 request.setCachePolicy(document_state->cache_policy_override()); 3118 request.setCachePolicy(document_state->cache_policy_override());
3118 transition_type = navigation_state->transition_type(); 3119 transition_type = navigation_state->transition_type();
3119 } 3120 }
3120 3121
3121 request.setExtraData( 3122 request.setExtraData(
3122 new RequestExtraData(frame->referrerPolicy(), 3123 new RequestExtraData(frame->referrerPolicy(),
3123 (frame == top_frame), 3124 (frame == top_frame),
3124 frame->identifier(), 3125 frame->identifier(),
3125 frame->parent() == top_frame, 3126 frame->parent() == top_frame,
3126 frame->parent() ? frame->parent()->identifier() : -1, 3127 frame->parent() ? frame->parent()->identifier() : -1,
3128 navigation_state->allow_download(),
3127 transition_type, 3129 transition_type,
3128 navigation_state->transferred_request_child_id(), 3130 navigation_state->transferred_request_child_id(),
3129 navigation_state->transferred_request_request_id())); 3131 navigation_state->transferred_request_request_id()));
3130 3132
3131 DocumentState* top_document_state = 3133 DocumentState* top_document_state =
3132 DocumentState::FromDataSource(top_data_source); 3134 DocumentState::FromDataSource(top_data_source);
3133 // TODO(gavinp): separate out prefetching and prerender field trials 3135 // TODO(gavinp): separate out prefetching and prerender field trials
3134 // if the rel=prerender rel type is sticking around. 3136 // if the rel=prerender rel type is sticking around.
3135 if (top_document_state && 3137 if (top_document_state &&
3136 (request.targetType() == WebURLRequest::TargetIsPrefetch || 3138 (request.targetType() == WebURLRequest::TargetIsPrefetch ||
(...skipping 2169 matching lines...) Expand 10 before | Expand all | Expand 10 after
5306 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { 5308 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const {
5307 return !!RenderThreadImpl::current()->compositor_thread(); 5309 return !!RenderThreadImpl::current()->compositor_thread();
5308 } 5310 }
5309 5311
5310 void RenderViewImpl::OnJavaBridgeInit() { 5312 void RenderViewImpl::OnJavaBridgeInit() {
5311 DCHECK(!java_bridge_dispatcher_.get()); 5313 DCHECK(!java_bridge_dispatcher_.get());
5312 #if defined(ENABLE_JAVA_BRIDGE) 5314 #if defined(ENABLE_JAVA_BRIDGE)
5313 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this)); 5315 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this));
5314 #endif 5316 #endif
5315 } 5317 }
OLDNEW
« no previous file with comments | « content/public/renderer/navigation_state.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698