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

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: 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 80
81 } // namespace 81 } // namespace
82 82
83 namespace data_reduction_proxy { 83 namespace data_reduction_proxy {
84 84
85 DataReductionProxySettings::DataReductionProxySettings( 85 DataReductionProxySettings::DataReductionProxySettings(
86 DataReductionProxyParams* params) 86 DataReductionProxyParams* params)
87 : restricted_by_carrier_(false), 87 : restricted_by_carrier_(false),
88 enabled_by_user_(false), 88 enabled_by_user_(false),
89 disabled_on_vpn_(false), 89 disabled_on_vpn_(false),
90 unreachable_(false),
90 prefs_(NULL), 91 prefs_(NULL),
91 local_state_prefs_(NULL), 92 local_state_prefs_(NULL),
92 url_request_context_getter_(NULL) { 93 url_request_context_getter_(NULL) {
93 DCHECK(params); 94 DCHECK(params);
94 params_.reset(params); 95 params_.reset(params);
95 } 96 }
96 97
97 DataReductionProxySettings::~DataReductionProxySettings() { 98 DataReductionProxySettings::~DataReductionProxySettings() {
98 if (params_->allowed()) 99 if (params_->allowed())
99 spdy_proxy_auth_enabled_.Destroy(); 100 spdy_proxy_auth_enabled_.Destroy();
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 base::Time last_update = base::Time::FromInternalValue(last_update_internal); 201 base::Time last_update = base::Time::FromInternalValue(last_update_internal);
201 return static_cast<int64>(last_update.ToJsTime()); 202 return static_cast<int64>(last_update.ToJsTime());
202 } 203 }
203 204
204 DataReductionProxySettings::ContentLengthList 205 DataReductionProxySettings::ContentLengthList
205 DataReductionProxySettings::GetDailyOriginalContentLengths() { 206 DataReductionProxySettings::GetDailyOriginalContentLengths() {
206 DCHECK(thread_checker_.CalledOnValidThread()); 207 DCHECK(thread_checker_.CalledOnValidThread());
207 return GetDailyContentLengths(prefs::kDailyHttpOriginalContentLength); 208 return GetDailyContentLengths(prefs::kDailyHttpOriginalContentLength);
208 } 209 }
209 210
211 void DataReductionProxySettings::SetUnreachable(bool unreachable) {
212 unreachable_ = unreachable;
213 }
214
210 bool DataReductionProxySettings::IsDataReductionProxyUnreachable() { 215 bool DataReductionProxySettings::IsDataReductionProxyUnreachable() {
211 DCHECK(thread_checker_.CalledOnValidThread()); 216 DCHECK(thread_checker_.CalledOnValidThread());
212 return usage_stats_ && usage_stats_->isDataReductionProxyUnreachable(); 217 return unreachable_;
213 }
214
215 void DataReductionProxySettings::SetDataReductionProxyUsageStats(
216 DataReductionProxyUsageStats* usage_stats) {
217 usage_stats_ = usage_stats;
218 } 218 }
219 219
220 DataReductionProxySettings::ContentLengthList 220 DataReductionProxySettings::ContentLengthList
221 DataReductionProxySettings::GetDailyReceivedContentLengths() { 221 DataReductionProxySettings::GetDailyReceivedContentLengths() {
222 DCHECK(thread_checker_.CalledOnValidThread()); 222 DCHECK(thread_checker_.CalledOnValidThread());
223 return GetDailyContentLengths(prefs::kDailyHttpReceivedContentLength); 223 return GetDailyContentLengths(prefs::kDailyHttpReceivedContentLength);
224 } 224 }
225 225
226 void DataReductionProxySettings::OnURLFetchComplete( 226 void DataReductionProxySettings::OnURLFetchComplete(
227 const net::URLFetcher* source) { 227 const net::URLFetcher* source) {
(...skipping 365 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