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

Side by Side Diff: chrome/browser/net/chrome_network_delegate.cc

Issue 1368383003: Only notify extensions about the end of a network request when it started (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 | « 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 "chrome/browser/net/chrome_network_delegate.h" 5 #include "chrome/browser/net/chrome_network_delegate.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 &request->url().possibly_invalid_spec())); 384 &request->url().possibly_invalid_spec()));
385 return error; 385 return error;
386 } 386 }
387 #endif 387 #endif
388 388
389 // TODO(mmenke): Remove ScopedTracker below once crbug.com/456327 is fixed. 389 // TODO(mmenke): Remove ScopedTracker below once crbug.com/456327 is fixed.
390 tracked_objects::ScopedTracker tracking_profile2( 390 tracked_objects::ScopedTracker tracking_profile2(
391 FROM_HERE_WITH_EXPLICIT_FUNCTION( 391 FROM_HERE_WITH_EXPLICIT_FUNCTION(
392 "456327 URLRequest::ChromeNetworkDelegate::OnBeforeURLRequest 2")); 392 "456327 URLRequest::ChromeNetworkDelegate::OnBeforeURLRequest 2"));
393 393
394 extensions_delegate_->ForwardStartRequestStatus(request); 394 extensions_delegate_->ForwardStartRequestStatus(request);
mmenke 2015/09/28 17:47:40 I think it we always called this in wrapped callba
mmenke 2015/09/28 17:48:34 That "or" means "and" (Since doing both will make
395 395
396 if (!enable_referrers_->GetValue()) 396 if (!enable_referrers_->GetValue())
397 request->SetReferrer(std::string()); 397 request->SetReferrer(std::string());
398 if (enable_do_not_track_ && enable_do_not_track_->GetValue()) 398 if (enable_do_not_track_ && enable_do_not_track_->GetValue())
399 request->SetExtraRequestHeaderByName(kDNTHeader, "1", true /* override */); 399 request->SetExtraRequestHeaderByName(kDNTHeader, "1", true /* override */);
400 400
401 // TODO(mmenke): Remove ScopedTracker below once crbug.com/456327 is fixed. 401 // TODO(mmenke): Remove ScopedTracker below once crbug.com/456327 is fixed.
402 tracked_objects::ScopedTracker tracking_profile3( 402 tracked_objects::ScopedTracker tracking_profile3(
403 FROM_HERE_WITH_EXPLICIT_FUNCTION( 403 FROM_HERE_WITH_EXPLICIT_FUNCTION(
404 "456327 URLRequest::ChromeNetworkDelegate::OnBeforeURLRequest 3")); 404 "456327 URLRequest::ChromeNetworkDelegate::OnBeforeURLRequest 3"));
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 } else if (request->status().status() == net::URLRequestStatus::FAILED || 528 } else if (request->status().status() == net::URLRequestStatus::FAILED ||
529 request->status().status() == net::URLRequestStatus::CANCELED) { 529 request->status().status() == net::URLRequestStatus::CANCELED) {
530 extensions_delegate_->OnCompleted(request, started); 530 extensions_delegate_->OnCompleted(request, started);
531 } else { 531 } else {
532 NOTREACHED(); 532 NOTREACHED();
533 } 533 }
534 if (domain_reliability_monitor_) 534 if (domain_reliability_monitor_)
535 domain_reliability_monitor_->OnCompleted(request, started); 535 domain_reliability_monitor_->OnCompleted(request, started);
536 RecordRequestSourceBandwidth(request, started); 536 RecordRequestSourceBandwidth(request, started);
537 extensions_delegate_->ForwardProxyErrors(request); 537 extensions_delegate_->ForwardProxyErrors(request);
538 extensions_delegate_->ForwardDoneRequestStatus(request); 538
539 // The ChromeExtensionNetworkDelegate only expects to be notified about the
540 // end of requests that were actually started.
541 if (started)
542 extensions_delegate_->ForwardDoneRequestStatus(request);
539 } 543 }
540 544
541 void ChromeNetworkDelegate::OnURLRequestDestroyed(net::URLRequest* request) { 545 void ChromeNetworkDelegate::OnURLRequestDestroyed(net::URLRequest* request) {
542 extensions_delegate_->OnURLRequestDestroyed(request); 546 extensions_delegate_->OnURLRequestDestroyed(request);
543 } 547 }
544 548
545 void ChromeNetworkDelegate::OnURLRequestJobOrphaned(net::URLRequest* request) { 549 void ChromeNetworkDelegate::OnURLRequestJobOrphaned(net::URLRequest* request) {
546 extensions_delegate_->OnURLRequestJobOrphaned(request); 550 extensions_delegate_->OnURLRequestJobOrphaned(request);
547 } 551 }
548 552
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 return experimental_web_platform_features_enabled_; 706 return experimental_web_platform_features_enabled_;
703 } 707 }
704 708
705 bool ChromeNetworkDelegate::OnCancelURLRequestWithPolicyViolatingReferrerHeader( 709 bool ChromeNetworkDelegate::OnCancelURLRequestWithPolicyViolatingReferrerHeader(
706 const net::URLRequest& request, 710 const net::URLRequest& request,
707 const GURL& target_url, 711 const GURL& target_url,
708 const GURL& referrer_url) const { 712 const GURL& referrer_url) const {
709 ReportInvalidReferrerSend(target_url, referrer_url); 713 ReportInvalidReferrerSend(target_url, referrer_url);
710 return true; 714 return true;
711 } 715 }
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