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_serv
ice.h" | 5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_serv
ice.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 const base::TimeDelta& commit_delay) { | 90 const base::TimeDelta& commit_delay) { |
91 DCHECK(CalledOnValidThread()); | 91 DCHECK(CalledOnValidThread()); |
92 DCHECK(!compression_stats_); | 92 DCHECK(!compression_stats_); |
93 DCHECK(!prefs_); | 93 DCHECK(!prefs_); |
94 prefs_ = prefs; | 94 prefs_ = prefs; |
95 compression_stats_.reset( | 95 compression_stats_.reset( |
96 new DataReductionProxyCompressionStats(this, prefs_, commit_delay)); | 96 new DataReductionProxyCompressionStats(this, prefs_, commit_delay)); |
97 } | 97 } |
98 | 98 |
99 void DataReductionProxyService::UpdateContentLengths( | 99 void DataReductionProxyService::UpdateContentLengths( |
100 int64 data_used, | 100 int64_t data_used, |
101 int64 original_size, | 101 int64_t original_size, |
102 bool data_reduction_proxy_enabled, | 102 bool data_reduction_proxy_enabled, |
103 DataReductionProxyRequestType request_type, | 103 DataReductionProxyRequestType request_type, |
104 const std::string& data_usage_host, | 104 const std::string& data_usage_host, |
105 const std::string& mime_type) { | 105 const std::string& mime_type) { |
106 DCHECK(CalledOnValidThread()); | 106 DCHECK(CalledOnValidThread()); |
107 if (compression_stats_) { | 107 if (compression_stats_) { |
108 compression_stats_->UpdateContentLengths( | 108 compression_stats_->UpdateContentLengths( |
109 data_used, original_size, data_reduction_proxy_enabled, request_type, | 109 data_used, original_size, data_reduction_proxy_enabled, request_type, |
110 data_usage_host, mime_type); | 110 data_usage_host, mime_type); |
111 } | 111 } |
(...skipping 12 matching lines...) Expand all Loading... |
124 | 124 |
125 void DataReductionProxyService::AddEventAndSecureProxyCheckState( | 125 void DataReductionProxyService::AddEventAndSecureProxyCheckState( |
126 scoped_ptr<base::Value> event, | 126 scoped_ptr<base::Value> event, |
127 SecureProxyCheckState state) { | 127 SecureProxyCheckState state) { |
128 DCHECK(CalledOnValidThread()); | 128 DCHECK(CalledOnValidThread()); |
129 event_store_->AddEventAndSecureProxyCheckState(event.Pass(), state); | 129 event_store_->AddEventAndSecureProxyCheckState(event.Pass(), state); |
130 } | 130 } |
131 | 131 |
132 void DataReductionProxyService::AddAndSetLastBypassEvent( | 132 void DataReductionProxyService::AddAndSetLastBypassEvent( |
133 scoped_ptr<base::Value> event, | 133 scoped_ptr<base::Value> event, |
134 int64 expiration_ticks) { | 134 int64_t expiration_ticks) { |
135 DCHECK(CalledOnValidThread()); | 135 DCHECK(CalledOnValidThread()); |
136 event_store_->AddAndSetLastBypassEvent(event.Pass(), expiration_ticks); | 136 event_store_->AddAndSetLastBypassEvent(event.Pass(), expiration_ticks); |
137 } | 137 } |
138 | 138 |
139 void DataReductionProxyService::SetUnreachable(bool unreachable) { | 139 void DataReductionProxyService::SetUnreachable(bool unreachable) { |
140 DCHECK(CalledOnValidThread()); | 140 DCHECK(CalledOnValidThread()); |
141 settings_->SetUnreachable(unreachable); | 141 settings_->SetUnreachable(unreachable); |
142 } | 142 } |
143 | 143 |
144 void DataReductionProxyService::SetLoFiModeActiveOnMainFrame( | 144 void DataReductionProxyService::SetLoFiModeActiveOnMainFrame( |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 prefs_->SetInteger(prefs::kLoFiSnackbarsShownPerSession, 0); | 227 prefs_->SetInteger(prefs::kLoFiSnackbarsShownPerSession, 0); |
228 prefs_->SetBoolean(prefs::kLoFiWasUsedThisSession, false); | 228 prefs_->SetBoolean(prefs::kLoFiWasUsedThisSession, false); |
229 } | 229 } |
230 | 230 |
231 void DataReductionProxyService::RecordLoFiSessionState(LoFiSessionState state) { | 231 void DataReductionProxyService::RecordLoFiSessionState(LoFiSessionState state) { |
232 UMA_HISTOGRAM_ENUMERATION("DataReductionProxy.LoFi.SessionState", state, | 232 UMA_HISTOGRAM_ENUMERATION("DataReductionProxy.LoFi.SessionState", state, |
233 LO_FI_SESSION_STATE_INDEX_BOUNDARY); | 233 LO_FI_SESSION_STATE_INDEX_BOUNDARY); |
234 } | 234 } |
235 | 235 |
236 void DataReductionProxyService::SetInt64Pref(const std::string& pref_path, | 236 void DataReductionProxyService::SetInt64Pref(const std::string& pref_path, |
237 int64 value) { | 237 int64_t value) { |
238 if (prefs_) | 238 if (prefs_) |
239 prefs_->SetInt64(pref_path, value); | 239 prefs_->SetInt64(pref_path, value); |
240 } | 240 } |
241 | 241 |
242 void DataReductionProxyService::SetStringPref(const std::string& pref_path, | 242 void DataReductionProxyService::SetStringPref(const std::string& pref_path, |
243 const std::string& value) { | 243 const std::string& value) { |
244 if (prefs_) | 244 if (prefs_) |
245 prefs_->SetString(pref_path, value); | 245 prefs_->SetString(pref_path, value); |
246 } | 246 } |
247 | 247 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 return initialized_; | 318 return initialized_; |
319 } | 319 } |
320 | 320 |
321 base::WeakPtr<DataReductionProxyService> | 321 base::WeakPtr<DataReductionProxyService> |
322 DataReductionProxyService::GetWeakPtr() { | 322 DataReductionProxyService::GetWeakPtr() { |
323 DCHECK(CalledOnValidThread()); | 323 DCHECK(CalledOnValidThread()); |
324 return weak_factory_.GetWeakPtr(); | 324 return weak_factory_.GetWeakPtr(); |
325 } | 325 } |
326 | 326 |
327 } // namespace data_reduction_proxy | 327 } // namespace data_reduction_proxy |
OLD | NEW |