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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_bypa
ss_protocol.h" | 10 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_bypa
ss_protocol.h" |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 return false; | 269 return false; |
270 } | 270 } |
271 return config_->ShouldEnableLoFiMode(request); | 271 return config_->ShouldEnableLoFiMode(request); |
272 } | 272 } |
273 | 273 |
274 void DataReductionProxyIOData::SetLoFiModeOff() { | 274 void DataReductionProxyIOData::SetLoFiModeOff() { |
275 config_->SetLoFiModeOff(); | 275 config_->SetLoFiModeOff(); |
276 } | 276 } |
277 | 277 |
278 void DataReductionProxyIOData::UpdateContentLengths( | 278 void DataReductionProxyIOData::UpdateContentLengths( |
279 int64 data_used, | 279 int64_t data_used, |
280 int64 original_size, | 280 int64_t original_size, |
281 bool data_reduction_proxy_enabled, | 281 bool data_reduction_proxy_enabled, |
282 DataReductionProxyRequestType request_type, | 282 DataReductionProxyRequestType request_type, |
283 const std::string& data_usage_host, | 283 const std::string& data_usage_host, |
284 const std::string& mime_type) { | 284 const std::string& mime_type) { |
285 DCHECK(io_task_runner_->BelongsToCurrentThread()); | 285 DCHECK(io_task_runner_->BelongsToCurrentThread()); |
286 ui_task_runner_->PostTask( | 286 ui_task_runner_->PostTask( |
287 FROM_HERE, | 287 FROM_HERE, |
288 base::Bind(&DataReductionProxyService::UpdateContentLengths, service_, | 288 base::Bind(&DataReductionProxyService::UpdateContentLengths, service_, |
289 data_used, original_size, data_reduction_proxy_enabled, | 289 data_used, original_size, data_reduction_proxy_enabled, |
290 request_type, data_usage_host, mime_type)); | 290 request_type, data_usage_host, mime_type)); |
(...skipping 28 matching lines...) Expand all Loading... |
319 SecureProxyCheckState state) { | 319 SecureProxyCheckState state) { |
320 DCHECK(io_task_runner_->BelongsToCurrentThread()); | 320 DCHECK(io_task_runner_->BelongsToCurrentThread()); |
321 ui_task_runner_->PostTask( | 321 ui_task_runner_->PostTask( |
322 FROM_HERE, | 322 FROM_HERE, |
323 base::Bind(&DataReductionProxyService::AddEventAndSecureProxyCheckState, | 323 base::Bind(&DataReductionProxyService::AddEventAndSecureProxyCheckState, |
324 service_, base::Passed(&event), state)); | 324 service_, base::Passed(&event), state)); |
325 } | 325 } |
326 | 326 |
327 void DataReductionProxyIOData::AddAndSetLastBypassEvent( | 327 void DataReductionProxyIOData::AddAndSetLastBypassEvent( |
328 scoped_ptr<base::Value> event, | 328 scoped_ptr<base::Value> event, |
329 int64 expiration_ticks) { | 329 int64_t expiration_ticks) { |
330 DCHECK(io_task_runner_->BelongsToCurrentThread()); | 330 DCHECK(io_task_runner_->BelongsToCurrentThread()); |
331 ui_task_runner_->PostTask( | 331 ui_task_runner_->PostTask( |
332 FROM_HERE, | 332 FROM_HERE, |
333 base::Bind(&DataReductionProxyService::AddAndSetLastBypassEvent, service_, | 333 base::Bind(&DataReductionProxyService::AddAndSetLastBypassEvent, service_, |
334 base::Passed(&event), expiration_ticks)); | 334 base::Passed(&event), expiration_ticks)); |
335 } | 335 } |
336 | 336 |
337 void DataReductionProxyIOData::SetUnreachable(bool unreachable) { | 337 void DataReductionProxyIOData::SetUnreachable(bool unreachable) { |
338 DCHECK(io_task_runner_->BelongsToCurrentThread()); | 338 DCHECK(io_task_runner_->BelongsToCurrentThread()); |
339 ui_task_runner_->PostTask( | 339 ui_task_runner_->PostTask( |
340 FROM_HERE, | 340 FROM_HERE, |
341 base::Bind(&DataReductionProxyService::SetUnreachable, | 341 base::Bind(&DataReductionProxyService::SetUnreachable, |
342 service_, unreachable)); | 342 service_, unreachable)); |
343 } | 343 } |
344 | 344 |
345 void DataReductionProxyIOData::SetInt64Pref(const std::string& pref_path, | 345 void DataReductionProxyIOData::SetInt64Pref(const std::string& pref_path, |
346 int64 value) { | 346 int64_t value) { |
347 DCHECK(io_task_runner_->BelongsToCurrentThread()); | 347 DCHECK(io_task_runner_->BelongsToCurrentThread()); |
348 ui_task_runner_->PostTask( | 348 ui_task_runner_->PostTask( |
349 FROM_HERE, base::Bind(&DataReductionProxyService::SetInt64Pref, service_, | 349 FROM_HERE, base::Bind(&DataReductionProxyService::SetInt64Pref, service_, |
350 pref_path, value)); | 350 pref_path, value)); |
351 } | 351 } |
352 | 352 |
353 void DataReductionProxyIOData::SetStringPref(const std::string& pref_path, | 353 void DataReductionProxyIOData::SetStringPref(const std::string& pref_path, |
354 const std::string& value) { | 354 const std::string& value) { |
355 DCHECK(io_task_runner_->BelongsToCurrentThread()); | 355 DCHECK(io_task_runner_->BelongsToCurrentThread()); |
356 ui_task_runner_->PostTask( | 356 ui_task_runner_->PostTask( |
357 FROM_HERE, base::Bind(&DataReductionProxyService::SetStringPref, service_, | 357 FROM_HERE, base::Bind(&DataReductionProxyService::SetStringPref, service_, |
358 pref_path, value)); | 358 pref_path, value)); |
359 } | 359 } |
360 | 360 |
361 void DataReductionProxyIOData::StoreSerializedConfig( | 361 void DataReductionProxyIOData::StoreSerializedConfig( |
362 const std::string& serialized_config) { | 362 const std::string& serialized_config) { |
363 DCHECK(io_task_runner_->BelongsToCurrentThread()); | 363 DCHECK(io_task_runner_->BelongsToCurrentThread()); |
364 SetStringPref(prefs::kDataReductionProxyConfig, serialized_config); | 364 SetStringPref(prefs::kDataReductionProxyConfig, serialized_config); |
365 } | 365 } |
366 | 366 |
367 } // namespace data_reduction_proxy | 367 } // namespace data_reduction_proxy |
OLD | NEW |