Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Side by Side Diff: components/data_reduction_proxy/browser/data_reduction_proxy_settings.cc

Issue 412143009: Moved data reduction proxy initialization logic to ProfileImplIOData (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments from willchan and sgurun Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/browser/data_reduction_proxy_settings. h" 5 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 84
85 } // namespace 85 } // namespace
86 86
87 namespace data_reduction_proxy { 87 namespace data_reduction_proxy {
88 88
89 DataReductionProxySettings::DataReductionProxySettings( 89 DataReductionProxySettings::DataReductionProxySettings(
90 DataReductionProxyParams* params) 90 DataReductionProxyParams* params)
91 : restricted_by_carrier_(false), 91 : restricted_by_carrier_(false),
92 enabled_by_user_(false), 92 enabled_by_user_(false),
93 disabled_on_vpn_(false), 93 disabled_on_vpn_(false),
94 unreachable_(false),
94 prefs_(NULL), 95 prefs_(NULL),
95 local_state_prefs_(NULL), 96 local_state_prefs_(NULL),
96 url_request_context_getter_(NULL) { 97 url_request_context_getter_(NULL) {
97 DCHECK(params); 98 DCHECK(params);
98 params_.reset(params); 99 params_.reset(params);
99 } 100 }
100 101
101 DataReductionProxySettings::~DataReductionProxySettings() { 102 DataReductionProxySettings::~DataReductionProxySettings() {
102 if (params_->allowed()) 103 if (params_->allowed())
103 spdy_proxy_auth_enabled_.Destroy(); 104 spdy_proxy_auth_enabled_.Destroy();
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 base::Time last_update = base::Time::FromInternalValue(last_update_internal); 205 base::Time last_update = base::Time::FromInternalValue(last_update_internal);
205 return static_cast<int64>(last_update.ToJsTime()); 206 return static_cast<int64>(last_update.ToJsTime());
206 } 207 }
207 208
208 DataReductionProxySettings::ContentLengthList 209 DataReductionProxySettings::ContentLengthList
209 DataReductionProxySettings::GetDailyOriginalContentLengths() { 210 DataReductionProxySettings::GetDailyOriginalContentLengths() {
210 DCHECK(thread_checker_.CalledOnValidThread()); 211 DCHECK(thread_checker_.CalledOnValidThread());
211 return GetDailyContentLengths(prefs::kDailyHttpOriginalContentLength); 212 return GetDailyContentLengths(prefs::kDailyHttpOriginalContentLength);
212 } 213 }
213 214
215 void DataReductionProxySettings::SetUnreachable(bool unreachable) {
216 unreachable_ = unreachable;
217 }
218
214 bool DataReductionProxySettings::IsDataReductionProxyUnreachable() { 219 bool DataReductionProxySettings::IsDataReductionProxyUnreachable() {
215 DCHECK(thread_checker_.CalledOnValidThread()); 220 DCHECK(thread_checker_.CalledOnValidThread());
216 return usage_stats_ && usage_stats_->isDataReductionProxyUnreachable(); 221 return unreachable_;
217 }
218
219 void DataReductionProxySettings::SetDataReductionProxyUsageStats(
220 DataReductionProxyUsageStats* usage_stats) {
221 usage_stats_ = usage_stats;
222 } 222 }
223 223
224 DataReductionProxySettings::ContentLengthList 224 DataReductionProxySettings::ContentLengthList
225 DataReductionProxySettings::GetDailyReceivedContentLengths() { 225 DataReductionProxySettings::GetDailyReceivedContentLengths() {
226 DCHECK(thread_checker_.CalledOnValidThread()); 226 DCHECK(thread_checker_.CalledOnValidThread());
227 return GetDailyContentLengths(prefs::kDailyHttpReceivedContentLength); 227 return GetDailyContentLengths(prefs::kDailyHttpReceivedContentLength);
228 } 228 }
229 229
230 void DataReductionProxySettings::OnURLFetchComplete( 230 void DataReductionProxySettings::OnURLFetchComplete(
231 const net::URLFetcher* source) { 231 const net::URLFetcher* source) {
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 SetProxyConfigs(enabled_by_user_, 593 SetProxyConfigs(enabled_by_user_,
594 IsDataReductionProxyAlternativeEnabled(), 594 IsDataReductionProxyAlternativeEnabled(),
595 restricted_by_carrier_, 595 restricted_by_carrier_,
596 false); 596 false);
597 } 597 }
598 disabled_on_vpn_ = false; 598 disabled_on_vpn_ = false;
599 return false; 599 return false;
600 } 600 }
601 601
602 } // namespace data_reduction_proxy 602 } // namespace data_reduction_proxy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698