OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_io_d
ata.h" | 5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 } | 283 } |
284 } | 284 } |
285 | 285 |
286 void DataReductionProxyIOData::SetDataReductionProxyConfiguration( | 286 void DataReductionProxyIOData::SetDataReductionProxyConfiguration( |
287 const std::string& serialized_config) { | 287 const std::string& serialized_config) { |
288 DCHECK(io_task_runner_->BelongsToCurrentThread()); | 288 DCHECK(io_task_runner_->BelongsToCurrentThread()); |
289 if (config_client_) | 289 if (config_client_) |
290 config_client_->ApplySerializedConfig(serialized_config); | 290 config_client_->ApplySerializedConfig(serialized_config); |
291 } | 291 } |
292 | 292 |
293 bool DataReductionProxyIOData::ShouldEnableLoFiMode( | 293 bool DataReductionProxyIOData::ShouldEnableLoFi( |
294 const net::URLRequest& request) { | 294 const net::URLRequest& request) { |
295 DCHECK((request.load_flags() & net::LOAD_MAIN_FRAME_DEPRECATED) != 0); | 295 DCHECK((request.load_flags() & net::LOAD_MAIN_FRAME_DEPRECATED) != 0); |
296 if (!config_ || (config_->IsBypassedByDataReductionProxyLocalRules( | 296 if (!config_ || (config_->IsBypassedByDataReductionProxyLocalRules( |
297 request, configurator_->GetProxyConfig()))) { | 297 request, configurator_->GetProxyConfig()))) { |
298 return false; | 298 return false; |
299 } | 299 } |
300 return config_->ShouldEnableLoFiMode(request); | 300 return config_->ShouldEnableLoFi(request); |
| 301 } |
| 302 |
| 303 bool DataReductionProxyIOData::ShouldEnableLitePages( |
| 304 const net::URLRequest& request) { |
| 305 DCHECK((request.load_flags() & net::LOAD_MAIN_FRAME_DEPRECATED) != 0); |
| 306 if (!config_ || (config_->IsBypassedByDataReductionProxyLocalRules( |
| 307 request, configurator_->GetProxyConfig()))) { |
| 308 return false; |
| 309 } |
| 310 return config_->ShouldEnableLitePages(request); |
301 } | 311 } |
302 | 312 |
303 void DataReductionProxyIOData::SetLoFiModeOff() { | 313 void DataReductionProxyIOData::SetLoFiModeOff() { |
304 config_->SetLoFiModeOff(); | 314 config_->SetLoFiModeOff(); |
305 } | 315 } |
306 | 316 |
307 void DataReductionProxyIOData::UpdateContentLengths( | 317 void DataReductionProxyIOData::UpdateContentLengths( |
308 int64_t data_used, | 318 int64_t data_used, |
309 int64_t original_size, | 319 int64_t original_size, |
310 bool data_reduction_proxy_enabled, | 320 bool data_reduction_proxy_enabled, |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 pref_path, value)); | 399 pref_path, value)); |
390 } | 400 } |
391 | 401 |
392 void DataReductionProxyIOData::StoreSerializedConfig( | 402 void DataReductionProxyIOData::StoreSerializedConfig( |
393 const std::string& serialized_config) { | 403 const std::string& serialized_config) { |
394 DCHECK(io_task_runner_->BelongsToCurrentThread()); | 404 DCHECK(io_task_runner_->BelongsToCurrentThread()); |
395 SetStringPref(prefs::kDataReductionProxyConfig, serialized_config); | 405 SetStringPref(prefs::kDataReductionProxyConfig, serialized_config); |
396 } | 406 } |
397 | 407 |
398 } // namespace data_reduction_proxy | 408 } // namespace data_reduction_proxy |
OLD | NEW |