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 <stdlib.h> | 7 #include <stdlib.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 Value* ChromeNetworkDelegate::SessionNetworkStatsInfoToValue() const { | 438 Value* ChromeNetworkDelegate::SessionNetworkStatsInfoToValue() const { |
439 DictionaryValue* dict = new DictionaryValue(); | 439 DictionaryValue* dict = new DictionaryValue(); |
440 // Use strings to avoid overflow. base::Value only supports 32-bit integers. | 440 // Use strings to avoid overflow. base::Value only supports 32-bit integers. |
441 dict->SetString("session_received_content_length", | 441 dict->SetString("session_received_content_length", |
442 base::Int64ToString(received_content_length_)); | 442 base::Int64ToString(received_content_length_)); |
443 dict->SetString("session_original_content_length", | 443 dict->SetString("session_original_content_length", |
444 base::Int64ToString(original_content_length_)); | 444 base::Int64ToString(original_content_length_)); |
445 return dict; | 445 return dict; |
446 } | 446 } |
447 | 447 |
| 448 void ChromeNetworkDelegate::OnBeforePreconnect( |
| 449 const GURL& url) { |
| 450 if (connect_interceptor_) |
| 451 connect_interceptor_->WitnessPreconnect(url); |
| 452 } |
| 453 |
448 int ChromeNetworkDelegate::OnBeforeURLRequest( | 454 int ChromeNetworkDelegate::OnBeforeURLRequest( |
449 net::URLRequest* request, | 455 net::URLRequest* request, |
450 const net::CompletionCallback& callback, | 456 const net::CompletionCallback& callback, |
451 GURL* new_url) { | 457 GURL* new_url) { |
452 #if defined(ENABLE_CONFIGURATION_POLICY) | 458 #if defined(ENABLE_CONFIGURATION_POLICY) |
453 // TODO(joaodasilva): This prevents extensions from seeing URLs that are | 459 // TODO(joaodasilva): This prevents extensions from seeing URLs that are |
454 // blocked. However, an extension might redirect the request to another URL, | 460 // blocked. However, an extension might redirect the request to another URL, |
455 // which is not blocked. | 461 // which is not blocked. |
456 if (url_blacklist_manager_ && | 462 if (url_blacklist_manager_ && |
457 url_blacklist_manager_->IsRequestBlocked(*request)) { | 463 url_blacklist_manager_->IsRequestBlocked(*request)) { |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 | 781 |
776 void ChromeNetworkDelegate::AccumulateContentLength( | 782 void ChromeNetworkDelegate::AccumulateContentLength( |
777 int64 received_content_length, int64 original_content_length) { | 783 int64 received_content_length, int64 original_content_length) { |
778 DCHECK_GE(received_content_length, 0); | 784 DCHECK_GE(received_content_length, 0); |
779 DCHECK_GE(original_content_length, 0); | 785 DCHECK_GE(original_content_length, 0); |
780 StoreAccumulatedContentLength(received_content_length, | 786 StoreAccumulatedContentLength(received_content_length, |
781 original_content_length); | 787 original_content_length); |
782 received_content_length_ += received_content_length; | 788 received_content_length_ += received_content_length; |
783 original_content_length_ += original_content_length; | 789 original_content_length_ += original_content_length; |
784 } | 790 } |
OLD | NEW |