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

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

Issue 7624031: Treat files downloaded from the address bar as "always safe" (including extensions per discussion... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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 | « content/common/resource_messages.h ('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) 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.h" 5 #include "content/renderer/render_view.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 2650 matching lines...) Expand 10 before | Expand all | Expand 10 after
2661 2661
2662 void RenderView::didUpdateCurrentHistoryItem(WebFrame* frame) { 2662 void RenderView::didUpdateCurrentHistoryItem(WebFrame* frame) {
2663 StartNavStateSyncTimerIfNecessary(); 2663 StartNavStateSyncTimerIfNecessary();
2664 } 2664 }
2665 2665
2666 void RenderView::assignIdentifierToRequest( 2666 void RenderView::assignIdentifierToRequest(
2667 WebFrame* frame, unsigned identifier, const WebURLRequest& request) { 2667 WebFrame* frame, unsigned identifier, const WebURLRequest& request) {
2668 // Ignore 2668 // Ignore
2669 } 2669 }
2670 2670
2671 void RenderView::willSendRequest( 2671 void RenderView::willSendRequest(WebFrame* frame,
2672 WebFrame* frame, unsigned identifier, WebURLRequest& request, 2672 unsigned identifier,
2673 const WebURLResponse& redirect_response) { 2673 WebURLRequest& request,
2674 const WebURLResponse& redirect_response) {
2674 WebFrame* top_frame = frame->top(); 2675 WebFrame* top_frame = frame->top();
2675 if (!top_frame) 2676 if (!top_frame)
2676 top_frame = frame; 2677 top_frame = frame;
2677 WebDataSource* provisional_data_source = top_frame->provisionalDataSource(); 2678 WebDataSource* provisional_data_source = top_frame->provisionalDataSource();
2678 WebDataSource* top_data_source = top_frame->dataSource(); 2679 WebDataSource* top_data_source = top_frame->dataSource();
2679 WebDataSource* data_source = 2680 WebDataSource* data_source =
2680 provisional_data_source ? provisional_data_source : top_data_source; 2681 provisional_data_source ? provisional_data_source : top_data_source;
2681 2682
2682 bool is_top_frame = (frame == top_frame);
2683 request.setExtraData(
2684 new RequestExtraData(is_top_frame, frame->identifier()));
2685
2686 GURL request_url(request.url()); 2683 GURL request_url(request.url());
2687 GURL new_url; 2684 GURL new_url;
2688 if (content::GetContentClient()->renderer()->WillSendRequest( 2685 if (content::GetContentClient()->renderer()->WillSendRequest(
2689 frame, request_url, &new_url)) { 2686 frame, request_url, &new_url)) {
2690 request.setURL(WebURL(new_url)); 2687 request.setURL(WebURL(new_url));
2691 } 2688 }
2692 2689
2693 if (data_source) { 2690 PageTransition::Type transition_type = PageTransition::LINK;
2694 NavigationState* state = NavigationState::FromDataSource(data_source); 2691 NavigationState* data_state = NavigationState::FromDataSource(data_source);
2695 if (state && state->is_cache_policy_override_set()) 2692 if (data_state) {
2696 request.setCachePolicy(state->cache_policy_override()); 2693 if (data_state->is_cache_policy_override_set())
2694 request.setCachePolicy(data_state->cache_policy_override());
2695 transition_type = data_state->transition_type();
2697 } 2696 }
2698 2697
2699 if (top_data_source) { 2698 request.setExtraData(new RequestExtraData((frame == top_frame),
2700 NavigationState* state = NavigationState::FromDataSource(top_data_source); 2699 frame->identifier(), transition_type));
2701 // TODO(gavinp): separate out prefetching and prerender field trials 2700
2702 // if the rel=prerender rel type is sticking around. 2701 NavigationState* top_data_state =
2703 if (state && (request.targetType() == WebURLRequest::TargetIsPrefetch || 2702 NavigationState::FromDataSource(top_data_source);
2704 request.targetType() == WebURLRequest::TargetIsPrerender)) 2703 // TODO(gavinp): separate out prefetching and prerender field trials
2705 state->set_was_prefetcher(true); 2704 // if the rel=prerender rel type is sticking around.
2706 } 2705 if (top_data_state &&
2706 (request.targetType() == WebURLRequest::TargetIsPrefetch ||
2707 request.targetType() == WebURLRequest::TargetIsPrerender))
2708 top_data_state->set_was_prefetcher(true);
2707 2709
2708 request.setRequestorID(routing_id_); 2710 request.setRequestorID(routing_id_);
2709 request.setHasUserGesture(frame->isProcessingUserGesture()); 2711 request.setHasUserGesture(frame->isProcessingUserGesture());
2710 2712
2711 if (!renderer_preferences_.enable_referrers) 2713 if (!renderer_preferences_.enable_referrers)
2712 request.clearHTTPHeaderField("Referer"); 2714 request.clearHTTPHeaderField("Referer");
2713 } 2715 }
2714 2716
2715 void RenderView::didReceiveResponse( 2717 void RenderView::didReceiveResponse(
2716 WebFrame* frame, unsigned identifier, const WebURLResponse& response) { 2718 WebFrame* frame, unsigned identifier, const WebURLResponse& response) {
(...skipping 1868 matching lines...) Expand 10 before | Expand all | Expand 10 after
4585 } 4587 }
4586 4588
4587 void RenderView::OnEnableViewSourceMode() { 4589 void RenderView::OnEnableViewSourceMode() {
4588 if (!webview()) 4590 if (!webview())
4589 return; 4591 return;
4590 WebFrame* main_frame = webview()->mainFrame(); 4592 WebFrame* main_frame = webview()->mainFrame();
4591 if (!main_frame) 4593 if (!main_frame)
4592 return; 4594 return;
4593 main_frame->enableViewSourceMode(true); 4595 main_frame->enableViewSourceMode(true);
4594 } 4596 }
OLDNEW
« no previous file with comments | « content/common/resource_messages.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698