| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett
ings.h" | 5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett
ings.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 } | 144 } |
| 145 } | 145 } |
| 146 | 146 |
| 147 int64_t DataReductionProxySettings::GetDataReductionLastUpdateTime() { | 147 int64_t DataReductionProxySettings::GetDataReductionLastUpdateTime() { |
| 148 DCHECK(thread_checker_.CalledOnValidThread()); | 148 DCHECK(thread_checker_.CalledOnValidThread()); |
| 149 DCHECK(data_reduction_proxy_service_->compression_stats()); | 149 DCHECK(data_reduction_proxy_service_->compression_stats()); |
| 150 return | 150 return |
| 151 data_reduction_proxy_service_->compression_stats()->GetLastUpdateTime(); | 151 data_reduction_proxy_service_->compression_stats()->GetLastUpdateTime(); |
| 152 } | 152 } |
| 153 | 153 |
| 154 int64_t DataReductionProxySettings::GetTotalHttpContentLengthSaved() { |
| 155 DCHECK(thread_checker_.CalledOnValidThread()); |
| 156 return data_reduction_proxy_service_->compression_stats() |
| 157 ->GetHttpOriginalContentLength() - |
| 158 data_reduction_proxy_service_->compression_stats() |
| 159 ->GetHttpReceivedContentLength(); |
| 160 } |
| 161 |
| 154 void DataReductionProxySettings::SetUnreachable(bool unreachable) { | 162 void DataReductionProxySettings::SetUnreachable(bool unreachable) { |
| 155 unreachable_ = unreachable; | 163 unreachable_ = unreachable; |
| 156 } | 164 } |
| 157 | 165 |
| 158 bool DataReductionProxySettings::IsDataReductionProxyUnreachable() { | 166 bool DataReductionProxySettings::IsDataReductionProxyUnreachable() { |
| 159 DCHECK(thread_checker_.CalledOnValidThread()); | 167 DCHECK(thread_checker_.CalledOnValidThread()); |
| 160 return unreachable_; | 168 return unreachable_; |
| 161 } | 169 } |
| 162 | 170 |
| 163 PrefService* DataReductionProxySettings::GetOriginalProfilePrefs() { | 171 PrefService* DataReductionProxySettings::GetOriginalProfilePrefs() { |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 int64_t data_used, | 378 int64_t data_used, |
| 371 int64_t original_size) { | 379 int64_t original_size) { |
| 372 if (!IsDataReductionProxyEnabled()) | 380 if (!IsDataReductionProxyEnabled()) |
| 373 return false; | 381 return false; |
| 374 data_reduction_proxy_service_->compression_stats()->UpdateDataSavings( | 382 data_reduction_proxy_service_->compression_stats()->UpdateDataSavings( |
| 375 data_usage_host, data_used, original_size); | 383 data_usage_host, data_used, original_size); |
| 376 return true; | 384 return true; |
| 377 } | 385 } |
| 378 | 386 |
| 379 } // namespace data_reduction_proxy | 387 } // namespace data_reduction_proxy |
| OLD | NEW |