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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 403 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
404 } | 404 } |
405 } | 405 } |
406 | 406 |
407 // static | 407 // static |
408 void ChromeNetworkDelegate::AllowAccessToAllFiles() { | 408 void ChromeNetworkDelegate::AllowAccessToAllFiles() { |
409 g_allow_file_access_ = true; | 409 g_allow_file_access_ = true; |
410 } | 410 } |
411 | 411 |
412 // static | 412 // static |
413 Value* ChromeNetworkDelegate::HistoricNetworkStatsInfoToValue() { | 413 base::Value* ChromeNetworkDelegate::HistoricNetworkStatsInfoToValue() { |
414 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 414 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
415 PrefService* prefs = g_browser_process->local_state(); | 415 PrefService* prefs = g_browser_process->local_state(); |
416 int64 total_received = prefs->GetInt64(prefs::kHttpReceivedContentLength); | 416 int64 total_received = prefs->GetInt64(prefs::kHttpReceivedContentLength); |
417 int64 total_original = prefs->GetInt64(prefs::kHttpOriginalContentLength); | 417 int64 total_original = prefs->GetInt64(prefs::kHttpOriginalContentLength); |
418 | 418 |
419 DictionaryValue* dict = new DictionaryValue(); | 419 base::DictionaryValue* dict = new base::DictionaryValue(); |
420 // Use strings to avoid overflow. base::Value only supports 32-bit integers. | 420 // Use strings to avoid overflow. base::Value only supports 32-bit integers. |
421 dict->SetString("historic_received_content_length", | 421 dict->SetString("historic_received_content_length", |
422 base::Int64ToString(total_received)); | 422 base::Int64ToString(total_received)); |
423 dict->SetString("historic_original_content_length", | 423 dict->SetString("historic_original_content_length", |
424 base::Int64ToString(total_original)); | 424 base::Int64ToString(total_original)); |
425 return dict; | 425 return dict; |
426 } | 426 } |
427 | 427 |
428 Value* ChromeNetworkDelegate::SessionNetworkStatsInfoToValue() const { | 428 base::Value* ChromeNetworkDelegate::SessionNetworkStatsInfoToValue() const { |
429 DictionaryValue* dict = new DictionaryValue(); | 429 base::DictionaryValue* dict = new base::DictionaryValue(); |
430 // Use strings to avoid overflow. base::Value only supports 32-bit integers. | 430 // Use strings to avoid overflow. base::Value only supports 32-bit integers. |
431 dict->SetString("session_received_content_length", | 431 dict->SetString("session_received_content_length", |
432 base::Int64ToString(received_content_length_)); | 432 base::Int64ToString(received_content_length_)); |
433 dict->SetString("session_original_content_length", | 433 dict->SetString("session_original_content_length", |
434 base::Int64ToString(original_content_length_)); | 434 base::Int64ToString(original_content_length_)); |
435 return dict; | 435 return dict; |
436 } | 436 } |
437 | 437 |
438 int ChromeNetworkDelegate::OnBeforeURLRequest( | 438 int ChromeNetworkDelegate::OnBeforeURLRequest( |
439 net::URLRequest* request, | 439 net::URLRequest* request, |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 spdyproxy::DataReductionRequestType data_reduction_type) { | 810 spdyproxy::DataReductionRequestType data_reduction_type) { |
811 DCHECK_GE(received_content_length, 0); | 811 DCHECK_GE(received_content_length, 0); |
812 DCHECK_GE(original_content_length, 0); | 812 DCHECK_GE(original_content_length, 0); |
813 StoreAccumulatedContentLength(received_content_length, | 813 StoreAccumulatedContentLength(received_content_length, |
814 original_content_length, | 814 original_content_length, |
815 data_reduction_type, | 815 data_reduction_type, |
816 reinterpret_cast<Profile*>(profile_)); | 816 reinterpret_cast<Profile*>(profile_)); |
817 received_content_length_ += received_content_length; | 817 received_content_length_ += received_content_length; |
818 original_content_length_ += original_content_length; | 818 original_content_length_ += original_content_length; |
819 } | 819 } |
OLD | NEW |