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

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: TabContents is now WebContentsImpl Created 8 years, 8 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
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 2648 matching lines...) Expand 10 before | Expand all | Expand 10 after
2659 // initiated any load resulting from JS execution. 2659 // initiated any load resulting from JS execution.
2660 if (!params.url.SchemeIs(chrome::kJavaScriptScheme)) { 2660 if (!params.url.SchemeIs(chrome::kJavaScriptScheme)) {
2661 navigation_state = NavigationState::CreateBrowserInitiated( 2661 navigation_state = NavigationState::CreateBrowserInitiated(
2662 params.page_id, 2662 params.page_id,
2663 params.pending_history_list_offset, 2663 params.pending_history_list_offset,
2664 params.transition); 2664 params.transition);
2665 navigation_state->set_transferred_request_child_id( 2665 navigation_state->set_transferred_request_child_id(
2666 params.transferred_request_child_id); 2666 params.transferred_request_child_id);
2667 navigation_state->set_transferred_request_request_id( 2667 navigation_state->set_transferred_request_request_id(
2668 params.transferred_request_request_id); 2668 params.transferred_request_request_id);
2669 navigation_state->set_allow_download(params.allow_download);
2669 } else { 2670 } else {
2670 navigation_state = NavigationState::CreateContentInitiated(); 2671 navigation_state = NavigationState::CreateContentInitiated();
2671 } 2672 }
2672 return navigation_state; 2673 return navigation_state;
2673 } 2674 }
2674 2675
2675 void RenderViewImpl::ProcessViewLayoutFlags(const CommandLine& command_line) { 2676 void RenderViewImpl::ProcessViewLayoutFlags(const CommandLine& command_line) {
2676 bool enable_viewport = 2677 bool enable_viewport =
2677 command_line.HasSwitch(switches::kEnableViewport); 2678 command_line.HasSwitch(switches::kEnableViewport);
2678 bool enable_fixed_layout = 2679 bool enable_fixed_layout =
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
3068 if (!top_frame) 3069 if (!top_frame)
3069 top_frame = frame; 3070 top_frame = frame;
3070 WebDataSource* provisional_data_source = top_frame->provisionalDataSource(); 3071 WebDataSource* provisional_data_source = top_frame->provisionalDataSource();
3071 WebDataSource* top_data_source = top_frame->dataSource(); 3072 WebDataSource* top_data_source = top_frame->dataSource();
3072 WebDataSource* data_source = 3073 WebDataSource* data_source =
3073 provisional_data_source ? provisional_data_source : top_data_source; 3074 provisional_data_source ? provisional_data_source : top_data_source;
3074 3075
3075 GURL request_url(request.url()); 3076 GURL request_url(request.url());
3076 GURL new_url; 3077 GURL new_url;
3077 if (content::GetContentClient()->renderer()->WillSendRequest( 3078 if (content::GetContentClient()->renderer()->WillSendRequest(
3078 frame, request_url, &new_url)) { 3079 frame, request_url, &new_url)) {
3079 request.setURL(WebURL(new_url)); 3080 request.setURL(WebURL(new_url));
3080 } 3081 }
3081 3082
3082 content::PageTransition transition_type = content::PAGE_TRANSITION_LINK; 3083 content::PageTransition transition_type = content::PAGE_TRANSITION_LINK;
3083 DocumentState* document_state = DocumentState::FromDataSource(data_source); 3084 DocumentState* document_state = DocumentState::FromDataSource(data_source);
3084 NavigationState* navigation_state = document_state->navigation_state(); 3085 NavigationState* navigation_state = document_state->navigation_state();
3085 if (document_state) { 3086 if (document_state) {
3086 if (document_state->is_cache_policy_override_set()) 3087 if (document_state->is_cache_policy_override_set())
3087 request.setCachePolicy(document_state->cache_policy_override()); 3088 request.setCachePolicy(document_state->cache_policy_override());
3088 transition_type = navigation_state->transition_type(); 3089 transition_type = navigation_state->transition_type();
3089 } 3090 }
3090 3091
3091 request.setExtraData( 3092 request.setExtraData(
3092 new RequestExtraData(frame->referrerPolicy(), 3093 new RequestExtraData(frame->referrerPolicy(),
3093 (frame == top_frame), 3094 (frame == top_frame),
3094 frame->identifier(), 3095 frame->identifier(),
3095 frame->parent() == top_frame, 3096 frame->parent() == top_frame,
3096 frame->parent() ? frame->parent()->identifier() : -1, 3097 frame->parent() ? frame->parent()->identifier() : -1,
3098 navigation_state->allow_download(),
3097 transition_type, 3099 transition_type,
3098 navigation_state->transferred_request_child_id(), 3100 navigation_state->transferred_request_child_id(),
3099 navigation_state->transferred_request_request_id())); 3101 navigation_state->transferred_request_request_id()));
3100 3102
3101 DocumentState* top_document_state = 3103 DocumentState* top_document_state =
3102 DocumentState::FromDataSource(top_data_source); 3104 DocumentState::FromDataSource(top_data_source);
3103 // TODO(gavinp): separate out prefetching and prerender field trials 3105 // TODO(gavinp): separate out prefetching and prerender field trials
3104 // if the rel=prerender rel type is sticking around. 3106 // if the rel=prerender rel type is sticking around.
3105 if (top_document_state && 3107 if (top_document_state &&
3106 (request.targetType() == WebURLRequest::TargetIsPrefetch || 3108 (request.targetType() == WebURLRequest::TargetIsPrefetch ||
(...skipping 2151 matching lines...) Expand 10 before | Expand all | Expand 10 after
5258 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { 5260 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const {
5259 return !!RenderThreadImpl::current()->compositor_thread(); 5261 return !!RenderThreadImpl::current()->compositor_thread();
5260 } 5262 }
5261 5263
5262 void RenderViewImpl::OnJavaBridgeInit() { 5264 void RenderViewImpl::OnJavaBridgeInit() {
5263 DCHECK(!java_bridge_dispatcher_.get()); 5265 DCHECK(!java_bridge_dispatcher_.get());
5264 #if defined(ENABLE_JAVA_BRIDGE) 5266 #if defined(ENABLE_JAVA_BRIDGE)
5265 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this)); 5267 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this));
5266 #endif 5268 #endif
5267 } 5269 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698