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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 // Note: Currently, OnNetworkBytesReceived is only implemented for HTTP jobs, | 350 // Note: Currently, OnNetworkBytesReceived is only implemented for HTTP jobs, |
351 // not FTP or other types, so those kinds of bytes will not be reported here. | 351 // not FTP or other types, so those kinds of bytes will not be reported here. |
352 task_manager::TaskManagerInterface::OnRawBytesRead(*request, bytes_received); | 352 task_manager::TaskManagerInterface::OnRawBytesRead(*request, bytes_received); |
353 #endif // !defined(OS_ANDROID) | 353 #endif // !defined(OS_ANDROID) |
354 | 354 |
355 ReportDataUsageStats(request, 0 /* tx_bytes */, bytes_received); | 355 ReportDataUsageStats(request, 0 /* tx_bytes */, bytes_received); |
356 } | 356 } |
357 | 357 |
358 void ChromeNetworkDelegate::OnNetworkBytesSent(net::URLRequest* request, | 358 void ChromeNetworkDelegate::OnNetworkBytesSent(net::URLRequest* request, |
359 int64_t bytes_sent) { | 359 int64_t bytes_sent) { |
| 360 #if !defined(OS_ANDROID) |
| 361 // Note: Currently, OnNetworkBytesSent is only implemented for HTTP jobs, |
| 362 // not FTP or other types, so those kinds of bytes will not be reported here. |
| 363 task_manager::TaskManagerInterface::OnRawBytesSent(*request, bytes_sent); |
| 364 #endif // !defined(OS_ANDROID) |
| 365 |
360 ReportDataUsageStats(request, bytes_sent, 0 /* rx_bytes */); | 366 ReportDataUsageStats(request, bytes_sent, 0 /* rx_bytes */); |
361 } | 367 } |
362 | 368 |
363 void ChromeNetworkDelegate::OnCompleted(net::URLRequest* request, | 369 void ChromeNetworkDelegate::OnCompleted(net::URLRequest* request, |
364 bool started, | 370 bool started, |
365 int net_error) { | 371 int net_error) { |
366 DCHECK_NE(net::ERR_IO_PENDING, net_error); | 372 DCHECK_NE(net::ERR_IO_PENDING, net_error); |
367 | 373 |
368 // TODO(amohammadkhan): Verify that there is no double recording in data use | 374 // TODO(amohammadkhan): Verify that there is no double recording in data use |
369 // of redirected requests. | 375 // of redirected requests. |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 if (!data_use_aggregator_) | 558 if (!data_use_aggregator_) |
553 return; | 559 return; |
554 | 560 |
555 if (is_data_usage_off_the_record_) { | 561 if (is_data_usage_off_the_record_) { |
556 data_use_aggregator_->ReportOffTheRecordDataUse(tx_bytes, rx_bytes); | 562 data_use_aggregator_->ReportOffTheRecordDataUse(tx_bytes, rx_bytes); |
557 return; | 563 return; |
558 } | 564 } |
559 | 565 |
560 data_use_aggregator_->ReportDataUse(request, tx_bytes, rx_bytes); | 566 data_use_aggregator_->ReportDataUse(request, tx_bytes, rx_bytes); |
561 } | 567 } |
OLD | NEW |