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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 #include "net/cookies/canonical_cookie.h" | 56 #include "net/cookies/canonical_cookie.h" |
57 #include "net/cookies/cookie_options.h" | 57 #include "net/cookies/cookie_options.h" |
58 #include "net/http/http_request_headers.h" | 58 #include "net/http/http_request_headers.h" |
59 #include "net/http/http_response_headers.h" | 59 #include "net/http/http_response_headers.h" |
60 #include "net/http/http_status_code.h" | 60 #include "net/http/http_status_code.h" |
61 #include "net/log/net_log.h" | 61 #include "net/log/net_log.h" |
62 #include "net/log/net_log_event_type.h" | 62 #include "net/log/net_log_event_type.h" |
63 #include "net/log/net_log_with_source.h" | 63 #include "net/log/net_log_with_source.h" |
64 #include "net/url_request/url_request.h" | 64 #include "net/url_request/url_request.h" |
65 | 65 |
66 #if BUILDFLAG(ANDROID_JAVA_UI) | 66 #if defined(OS_ANDROID) |
67 #include "chrome/browser/io_thread.h" | 67 #include "chrome/browser/io_thread.h" |
68 #include "chrome/browser/precache/precache_util.h" | 68 #include "chrome/browser/precache/precache_util.h" |
69 #endif | 69 #endif |
70 | 70 |
71 #if defined(OS_CHROMEOS) | 71 #if defined(OS_CHROMEOS) |
72 #include "base/sys_info.h" | 72 #include "base/sys_info.h" |
73 #include "chrome/common/chrome_switches.h" | 73 #include "chrome/common/chrome_switches.h" |
74 #endif | 74 #endif |
75 | 75 |
76 #if BUILDFLAG(ENABLE_EXTENSIONS) | 76 #if BUILDFLAG(ENABLE_EXTENSIONS) |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 void ChromeNetworkDelegate::OnCompleted(net::URLRequest* request, | 377 void ChromeNetworkDelegate::OnCompleted(net::URLRequest* request, |
378 bool started, | 378 bool started, |
379 int net_error) { | 379 int net_error) { |
380 DCHECK_NE(net::ERR_IO_PENDING, net_error); | 380 DCHECK_NE(net::ERR_IO_PENDING, net_error); |
381 | 381 |
382 // TODO(amohammadkhan): Verify that there is no double recording in data use | 382 // TODO(amohammadkhan): Verify that there is no double recording in data use |
383 // of redirected requests. | 383 // of redirected requests. |
384 RecordNetworkErrorHistograms(request, net_error); | 384 RecordNetworkErrorHistograms(request, net_error); |
385 | 385 |
386 if (net_error == net::OK) { | 386 if (net_error == net::OK) { |
387 #if BUILDFLAG(ANDROID_JAVA_UI) | 387 #if defined(OS_ANDROID) |
388 precache::UpdatePrecacheMetricsAndState(request, profile_); | 388 precache::UpdatePrecacheMetricsAndState(request, profile_); |
389 #endif // BUILDFLAG(ANDROID_JAVA_UI) | 389 #endif // defined(OS_ANDROID) |
390 } | 390 } |
391 | 391 |
392 extensions_delegate_->OnCompleted(request, started, net_error); | 392 extensions_delegate_->OnCompleted(request, started, net_error); |
393 if (domain_reliability_monitor_) | 393 if (domain_reliability_monitor_) |
394 domain_reliability_monitor_->OnCompleted(request, started); | 394 domain_reliability_monitor_->OnCompleted(request, started); |
395 RecordRequestSourceBandwidth(request, started); | 395 RecordRequestSourceBandwidth(request, started); |
396 extensions_delegate_->ForwardProxyErrors(request, net_error); | 396 extensions_delegate_->ForwardProxyErrors(request, net_error); |
397 extensions_delegate_->ForwardDoneRequestStatus(request); | 397 extensions_delegate_->ForwardDoneRequestStatus(request); |
398 } | 398 } |
399 | 399 |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 if (!data_use_aggregator_) | 576 if (!data_use_aggregator_) |
577 return; | 577 return; |
578 | 578 |
579 if (is_data_usage_off_the_record_) { | 579 if (is_data_usage_off_the_record_) { |
580 data_use_aggregator_->ReportOffTheRecordDataUse(tx_bytes, rx_bytes); | 580 data_use_aggregator_->ReportOffTheRecordDataUse(tx_bytes, rx_bytes); |
581 return; | 581 return; |
582 } | 582 } |
583 | 583 |
584 data_use_aggregator_->ReportDataUse(request, tx_bytes, rx_bytes); | 584 data_use_aggregator_->ReportDataUse(request, tx_bytes, rx_bytes); |
585 } | 585 } |
OLD | NEW |