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

Side by Side Diff: components/data_reduction_proxy/browser/data_reduction_proxy_config_service.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_config_se rvice.h" 5 #include "components/data_reduction_proxy/browser/data_reduction_proxy_config_se rvice.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 } 109 }
110 110
111 void DataReductionProxyConfigService::RegisterObserver() { 111 void DataReductionProxyConfigService::RegisterObserver() {
112 if (!registered_observer_ && base_service_.get()) { 112 if (!registered_observer_ && base_service_.get()) {
113 base_service_->AddObserver(this); 113 base_service_->AddObserver(this);
114 registered_observer_ = true; 114 registered_observer_ = true;
115 } 115 }
116 } 116 }
117 117
118 DataReductionProxyConfigTracker::DataReductionProxyConfigTracker( 118 DataReductionProxyConfigTracker::DataReductionProxyConfigTracker(
119 DataReductionProxyConfigService* config_service, 119 base::Callback<void(bool, const net::ProxyConfig&)> update_proxy_config,
120 base::TaskRunner* task_runner) 120 base::TaskRunner* task_runner)
121 : config_service_(config_service), 121 : update_proxy_config_(update_proxy_config),
122 task_runner_(task_runner) { 122 task_runner_(task_runner) {
123 DCHECK(config_service);
124 } 123 }
125 124
126 DataReductionProxyConfigTracker::~DataReductionProxyConfigTracker() { 125 DataReductionProxyConfigTracker::~DataReductionProxyConfigTracker() {
127 } 126 }
128 127
129 void DataReductionProxyConfigTracker::Enable( 128 void DataReductionProxyConfigTracker::Enable(
130 bool primary_restricted, 129 bool primary_restricted,
131 bool fallback_restricted, 130 bool fallback_restricted,
132 const std::string& primary_origin, 131 const std::string& primary_origin,
133 const std::string& fallback_origin, 132 const std::string& fallback_origin,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 host_pattern = pattern.substr(0, pos); 186 host_pattern = pattern.substr(0, pos);
188 else 187 else
189 host_pattern = pattern; 188 host_pattern = pattern;
190 189
191 AddHostPatternToBypass(host_pattern); 190 AddHostPatternToBypass(host_pattern);
192 } 191 }
193 192
194 void DataReductionProxyConfigTracker::UpdateProxyConfigOnIOThread( 193 void DataReductionProxyConfigTracker::UpdateProxyConfigOnIOThread(
195 bool enabled, 194 bool enabled,
196 const net::ProxyConfig& config) { 195 const net::ProxyConfig& config) {
197 task_runner_->PostTask(FROM_HERE, 196 task_runner_->PostTask(
198 base::Bind( 197 FROM_HERE, base::Bind(update_proxy_config_, enabled, config));
199 &DataReductionProxyConfigService::UpdateProxyConfig,
200 base::Unretained(config_service_),
201 enabled, config));
202 } 198 }
203 199
204 } // namespace data_reduction_proxy 200 } // namespace data_reduction_proxy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698