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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 } // namespace | 47 } // namespace |
48 | 48 |
49 namespace data_reduction_proxy { | 49 namespace data_reduction_proxy { |
50 | 50 |
51 const char kDataReductionPassThroughHeader[] = | 51 const char kDataReductionPassThroughHeader[] = |
52 "Chrome-Proxy-Accept-Transform: identity\nCache-Control: no-cache"; | 52 "Chrome-Proxy-Accept-Transform: identity\nCache-Control: no-cache"; |
53 | 53 |
54 DataReductionProxySettings::DataReductionProxySettings() | 54 DataReductionProxySettings::DataReductionProxySettings() |
55 : unreachable_(false), | 55 : unreachable_(false), |
56 deferred_initialization_(false), | 56 deferred_initialization_(false), |
57 promo_allowed_(false), | |
58 data_reduction_proxy_enabled_pref_name_(), | 57 data_reduction_proxy_enabled_pref_name_(), |
59 prefs_(NULL), | 58 prefs_(NULL), |
60 config_(nullptr), | 59 config_(nullptr), |
61 clock_(new base::DefaultClock()) { | 60 clock_(new base::DefaultClock()) { |
62 lo_fi_user_requests_for_images_per_session_ = | 61 lo_fi_user_requests_for_images_per_session_ = |
63 params::GetFieldTrialParameterAsInteger( | 62 params::GetFieldTrialParameterAsInteger( |
64 params::GetLoFiFieldTrialName(), "load_images_requests_per_session", | 63 params::GetLoFiFieldTrialName(), "load_images_requests_per_session", |
65 3, 0); | 64 3, 0); |
66 lo_fi_consecutive_session_disables_ = params::GetFieldTrialParameterAsInteger( | 65 lo_fi_consecutive_session_disables_ = params::GetFieldTrialParameterAsInteger( |
67 params::GetLoFiFieldTrialName(), "consecutive_session_disables", 3, 0); | 66 params::GetLoFiFieldTrialName(), "consecutive_session_disables", 3, 0); |
68 } | 67 } |
69 | 68 |
70 DataReductionProxySettings::~DataReductionProxySettings() { | 69 DataReductionProxySettings::~DataReductionProxySettings() { |
71 spdy_proxy_auth_enabled_.Destroy(); | 70 spdy_proxy_auth_enabled_.Destroy(); |
72 } | 71 } |
73 | 72 |
74 void DataReductionProxySettings::InitPrefMembers() { | 73 void DataReductionProxySettings::InitPrefMembers() { |
75 DCHECK(thread_checker_.CalledOnValidThread()); | 74 DCHECK(thread_checker_.CalledOnValidThread()); |
76 spdy_proxy_auth_enabled_.Init( | 75 spdy_proxy_auth_enabled_.Init( |
77 data_reduction_proxy_enabled_pref_name_, GetOriginalProfilePrefs(), | 76 data_reduction_proxy_enabled_pref_name_, GetOriginalProfilePrefs(), |
78 base::Bind(&DataReductionProxySettings::OnProxyEnabledPrefChange, | 77 base::Bind(&DataReductionProxySettings::OnProxyEnabledPrefChange, |
79 base::Unretained(this))); | 78 base::Unretained(this))); |
80 } | 79 } |
81 | 80 |
82 void DataReductionProxySettings::UpdateConfigValues() { | 81 void DataReductionProxySettings::UpdateConfigValues() { |
megjablon
2017/06/02 23:01:50
Remove this method.
tbansal1
2017/06/05 13:48:24
More cleanup. Yay!
Done.
| |
83 DCHECK(config_); | 82 DCHECK(config_); |
84 promo_allowed_ = config_->promo_allowed(); | |
85 } | 83 } |
86 | 84 |
87 void DataReductionProxySettings::InitDataReductionProxySettings( | 85 void DataReductionProxySettings::InitDataReductionProxySettings( |
88 const std::string& data_reduction_proxy_enabled_pref_name, | 86 const std::string& data_reduction_proxy_enabled_pref_name, |
89 PrefService* prefs, | 87 PrefService* prefs, |
90 DataReductionProxyIOData* io_data, | 88 DataReductionProxyIOData* io_data, |
91 std::unique_ptr<DataReductionProxyService> data_reduction_proxy_service) { | 89 std::unique_ptr<DataReductionProxyService> data_reduction_proxy_service) { |
92 DCHECK(thread_checker_.CalledOnValidThread()); | 90 DCHECK(thread_checker_.CalledOnValidThread()); |
93 DCHECK(!data_reduction_proxy_enabled_pref_name.empty()); | 91 DCHECK(!data_reduction_proxy_enabled_pref_name.empty()); |
94 DCHECK(prefs); | 92 DCHECK(prefs); |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
405 int64_t* received_content_length, | 403 int64_t* received_content_length, |
406 int64_t* last_update_time) { | 404 int64_t* last_update_time) { |
407 DCHECK(thread_checker_.CalledOnValidThread()); | 405 DCHECK(thread_checker_.CalledOnValidThread()); |
408 DCHECK(data_reduction_proxy_service_->compression_stats()); | 406 DCHECK(data_reduction_proxy_service_->compression_stats()); |
409 | 407 |
410 data_reduction_proxy_service_->compression_stats()->GetContentLengths( | 408 data_reduction_proxy_service_->compression_stats()->GetContentLengths( |
411 days, original_content_length, received_content_length, last_update_time); | 409 days, original_content_length, received_content_length, last_update_time); |
412 } | 410 } |
413 | 411 |
414 } // namespace data_reduction_proxy | 412 } // namespace data_reduction_proxy |
OLD | NEW |