| OLD | NEW |
| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 | 230 |
| 231 int ChromeNetworkDelegate::OnBeforeURLRequest( | 231 int ChromeNetworkDelegate::OnBeforeURLRequest( |
| 232 net::URLRequest* request, | 232 net::URLRequest* request, |
| 233 const net::CompletionCallback& callback, | 233 const net::CompletionCallback& callback, |
| 234 GURL* new_url) { | 234 GURL* new_url) { |
| 235 // TODO(mmenke): Remove ScopedTracker below once crbug.com/456327 is fixed. | 235 // TODO(mmenke): Remove ScopedTracker below once crbug.com/456327 is fixed. |
| 236 tracked_objects::ScopedTracker tracking_profile1( | 236 tracked_objects::ScopedTracker tracking_profile1( |
| 237 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 237 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 238 "456327 URLRequest::ChromeNetworkDelegate::OnBeforeURLRequest")); | 238 "456327 URLRequest::ChromeNetworkDelegate::OnBeforeURLRequest")); |
| 239 | 239 |
| 240 data_use_measurement_.OnBeforeURLRequest(request); |
| 241 |
| 240 // TODO(joaodasilva): This prevents extensions from seeing URLs that are | 242 // TODO(joaodasilva): This prevents extensions from seeing URLs that are |
| 241 // blocked. However, an extension might redirect the request to another URL, | 243 // blocked. However, an extension might redirect the request to another URL, |
| 242 // which is not blocked. | 244 // which is not blocked. |
| 243 | 245 |
| 244 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); | 246 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); |
| 245 int error = net::ERR_BLOCKED_BY_ADMINISTRATOR; | 247 int error = net::ERR_BLOCKED_BY_ADMINISTRATOR; |
| 246 if (info && content::IsResourceTypeFrame(info->GetResourceType()) && | 248 if (info && content::IsResourceTypeFrame(info->GetResourceType()) && |
| 247 url_blacklist_manager_ && | 249 url_blacklist_manager_ && |
| 248 url_blacklist_manager_->ShouldBlockRequestForFrame( | 250 url_blacklist_manager_->ShouldBlockRequestForFrame( |
| 249 request->url(), &error)) { | 251 request->url(), &error)) { |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 if (!data_use_aggregator_) | 586 if (!data_use_aggregator_) |
| 585 return; | 587 return; |
| 586 | 588 |
| 587 if (is_data_usage_off_the_record_) { | 589 if (is_data_usage_off_the_record_) { |
| 588 data_use_aggregator_->ReportOffTheRecordDataUse(tx_bytes, rx_bytes); | 590 data_use_aggregator_->ReportOffTheRecordDataUse(tx_bytes, rx_bytes); |
| 589 return; | 591 return; |
| 590 } | 592 } |
| 591 | 593 |
| 592 data_use_aggregator_->ReportDataUse(request, tx_bytes, rx_bytes); | 594 data_use_aggregator_->ReportDataUse(request, tx_bytes, rx_bytes); |
| 593 } | 595 } |
| OLD | NEW |