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

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: nit 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 base::Time last_update = base::Time::FromInternalValue(last_update_internal); 212 base::Time last_update = base::Time::FromInternalValue(last_update_internal);
212 return static_cast<int64>(last_update.ToJsTime()); 213 return static_cast<int64>(last_update.ToJsTime());
213 } 214 }
214 215
215 DataReductionProxySettings::ContentLengthList 216 DataReductionProxySettings::ContentLengthList
216 DataReductionProxySettings::GetDailyOriginalContentLengths() { 217 DataReductionProxySettings::GetDailyOriginalContentLengths() {
217 DCHECK(thread_checker_.CalledOnValidThread()); 218 DCHECK(thread_checker_.CalledOnValidThread());
218 return GetDailyContentLengths(prefs::kDailyHttpOriginalContentLength); 219 return GetDailyContentLengths(prefs::kDailyHttpOriginalContentLength);
219 } 220 }
220 221
222 void DataReductionProxySettings::SetUnreachable(bool unreachable) {
223 unreachable_ = unreachable;
224 }
225
221 bool DataReductionProxySettings::IsDataReductionProxyUnreachable() { 226 bool DataReductionProxySettings::IsDataReductionProxyUnreachable() {
222 DCHECK(thread_checker_.CalledOnValidThread()); 227 DCHECK(thread_checker_.CalledOnValidThread());
223 return usage_stats_ && usage_stats_->isDataReductionProxyUnreachable(); 228 return unreachable_;
224 }
225
226 void DataReductionProxySettings::SetDataReductionProxyUsageStats(
227 DataReductionProxyUsageStats* usage_stats) {
228 usage_stats_ = usage_stats;
229 } 229 }
230 230
231 DataReductionProxySettings::ContentLengthList 231 DataReductionProxySettings::ContentLengthList
232 DataReductionProxySettings::GetDailyReceivedContentLengths() { 232 DataReductionProxySettings::GetDailyReceivedContentLengths() {
233 DCHECK(thread_checker_.CalledOnValidThread()); 233 DCHECK(thread_checker_.CalledOnValidThread());
234 return GetDailyContentLengths(prefs::kDailyHttpReceivedContentLength); 234 return GetDailyContentLengths(prefs::kDailyHttpReceivedContentLength);
235 } 235 }
236 236
237 void DataReductionProxySettings::OnURLFetchComplete( 237 void DataReductionProxySettings::OnURLFetchComplete(
238 const net::URLFetcher* source) { 238 const net::URLFetcher* source) {
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 SetProxyConfigs(enabled_by_user_, 602 SetProxyConfigs(enabled_by_user_,
603 IsDataReductionProxyAlternativeEnabled(), 603 IsDataReductionProxyAlternativeEnabled(),
604 restricted_by_carrier_, 604 restricted_by_carrier_,
605 false); 605 false);
606 } 606 }
607 disabled_on_vpn_ = false; 607 disabled_on_vpn_ = false;
608 return false; 608 return false;
609 } 609 }
610 610
611 } // namespace data_reduction_proxy 611 } // namespace data_reduction_proxy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698