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

Side by Side Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 12569007: Remove URL fragment from referrer HTTP header when opening link using "Open Link in New Tab" option. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync up to rev 193385 Created 7 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 | Annotate | Revision Log
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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading
6 6
7 #include "content/browser/loader/resource_dispatcher_host_impl.h" 7 #include "content/browser/loader/resource_dispatcher_host_impl.h"
8 8
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 return CallbackAndReturn(started_callback, net::ERR_INSUFFICIENT_RESOURCES); 458 return CallbackAndReturn(started_callback, net::ERR_INSUFFICIENT_RESOURCES);
459 459
460 const GURL& url = request->original_url(); 460 const GURL& url = request->original_url();
461 461
462 // http://crbug.com/90971 462 // http://crbug.com/90971
463 char url_buf[128]; 463 char url_buf[128];
464 base::strlcpy(url_buf, url.spec().c_str(), arraysize(url_buf)); 464 base::strlcpy(url_buf, url.spec().c_str(), arraysize(url_buf));
465 base::debug::Alias(url_buf); 465 base::debug::Alias(url_buf);
466 CHECK(ContainsKey(active_resource_contexts_, context)); 466 CHECK(ContainsKey(active_resource_contexts_, context));
467 467
468 request->set_referrer(MaybeStripReferrer(GURL(request->referrer())).spec()); 468 request->SetReferrer(MaybeStripReferrer(GURL(request->referrer())).spec());
469 int extra_load_flags = net::LOAD_IS_DOWNLOAD; 469 int extra_load_flags = net::LOAD_IS_DOWNLOAD;
470 if (prefer_cache) { 470 if (prefer_cache) {
471 // If there is upload data attached, only retrieve from cache because there 471 // If there is upload data attached, only retrieve from cache because there
472 // is no current mechanism to prompt the user for their consent for a 472 // is no current mechanism to prompt the user for their consent for a
473 // re-post. For GETs, try to retrieve data from the cache and skip 473 // re-post. For GETs, try to retrieve data from the cache and skip
474 // validating the entry if present. 474 // validating the entry if present.
475 if (request->get_upload() != NULL) 475 if (request->get_upload() != NULL)
476 extra_load_flags |= net::LOAD_ONLY_FROM_CACHE; 476 extra_load_flags |= net::LOAD_ONLY_FROM_CACHE;
477 else 477 else
478 extra_load_flags |= net::LOAD_PREFERRING_CACHE; 478 extra_load_flags |= net::LOAD_PREFERRING_CACHE;
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 // chance to reset some state before we complete the transfer. 946 // chance to reset some state before we complete the transfer.
947 deferred_loader->WillCompleteTransfer(); 947 deferred_loader->WillCompleteTransfer();
948 } else { 948 } else {
949 net::URLRequestContext* context = 949 net::URLRequestContext* context =
950 filter_->GetURLRequestContext(request_data.resource_type); 950 filter_->GetURLRequestContext(request_data.resource_type);
951 new_request.reset(context->CreateRequest(request_data.url, NULL)); 951 new_request.reset(context->CreateRequest(request_data.url, NULL));
952 request = new_request.get(); 952 request = new_request.get();
953 953
954 request->set_method(request_data.method); 954 request->set_method(request_data.method);
955 request->set_first_party_for_cookies(request_data.first_party_for_cookies); 955 request->set_first_party_for_cookies(request_data.first_party_for_cookies);
956 request->set_referrer(referrer.url.spec()); 956 request->SetReferrer(referrer.url.spec());
957 webkit_glue::ConfigureURLRequestForReferrerPolicy(request, 957 webkit_glue::ConfigureURLRequestForReferrerPolicy(request,
958 referrer.policy); 958 referrer.policy);
959 net::HttpRequestHeaders headers; 959 net::HttpRequestHeaders headers;
960 headers.AddHeadersFromString(request_data.headers); 960 headers.AddHeadersFromString(request_data.headers);
961 request->SetExtraRequestHeaders(headers); 961 request->SetExtraRequestHeaders(headers);
962 } 962 }
963 963
964 // TODO(darin): Do we really need all of these URLRequest setters in the 964 // TODO(darin): Do we really need all of these URLRequest setters in the
965 // transferred navigation case? 965 // transferred navigation case?
966 966
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1262 // Since any URLs which have non-standard scheme have been filtered 1262 // Since any URLs which have non-standard scheme have been filtered
1263 // by save manager(see GURL::SchemeIsStandard). This situation 1263 // by save manager(see GURL::SchemeIsStandard). This situation
1264 // should not happen. 1264 // should not happen.
1265 NOTREACHED(); 1265 NOTREACHED();
1266 return; 1266 return;
1267 } 1267 }
1268 1268
1269 scoped_ptr<net::URLRequest> request( 1269 scoped_ptr<net::URLRequest> request(
1270 request_context->CreateRequest(url, NULL)); 1270 request_context->CreateRequest(url, NULL));
1271 request->set_method("GET"); 1271 request->set_method("GET");
1272 request->set_referrer(MaybeStripReferrer(referrer.url).spec()); 1272 request->SetReferrer(MaybeStripReferrer(referrer.url).spec());
1273 webkit_glue::ConfigureURLRequestForReferrerPolicy(request.get(), 1273 webkit_glue::ConfigureURLRequestForReferrerPolicy(request.get(),
1274 referrer.policy); 1274 referrer.policy);
1275 // So far, for saving page, we need fetch content from cache, in the 1275 // So far, for saving page, we need fetch content from cache, in the
1276 // future, maybe we can use a configuration to configure this behavior. 1276 // future, maybe we can use a configuration to configure this behavior.
1277 request->set_load_flags(net::LOAD_PREFERRING_CACHE); 1277 request->set_load_flags(net::LOAD_PREFERRING_CACHE);
1278 1278
1279 // Since we're just saving some resources we need, disallow downloading. 1279 // Since we're just saving some resources we need, disallow downloading.
1280 ResourceRequestInfoImpl* extra_info = 1280 ResourceRequestInfoImpl* extra_info =
1281 CreateRequestInfo(child_id, route_id, false, context); 1281 CreateRequestInfo(child_id, route_id, false, context);
1282 extra_info->AssociateWithRequest(request.get()); // Request takes ownership. 1282 extra_info->AssociateWithRequest(request.get()); // Request takes ownership.
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
1756 DelegateMap::iterator it = delegate_map_.find(id); 1756 DelegateMap::iterator it = delegate_map_.find(id);
1757 DCHECK(it->second->HasObserver(delegate)); 1757 DCHECK(it->second->HasObserver(delegate));
1758 it->second->RemoveObserver(delegate); 1758 it->second->RemoveObserver(delegate);
1759 if (it->second->size() == 0) { 1759 if (it->second->size() == 0) {
1760 delete it->second; 1760 delete it->second;
1761 delegate_map_.erase(it); 1761 delegate_map_.erase(it);
1762 } 1762 }
1763 } 1763 }
1764 1764
1765 } // namespace content 1765 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/download_manager_impl.cc ('k') | content/browser/loader/resource_dispatcher_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698