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

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc

Issue 778463002: Wrapped data reduction proxy initialization into its own class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@network-delegate
Patch Set: Addressed comments from sclittle Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc
index 9ef087b0ced722e1a3e74496f1086a6f95932406..24898ee1dd21175439c7372ab164873f04daaefa 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc
@@ -11,6 +11,7 @@
#include "base/strings/string_number_conversions.h"
#include "base/time/time.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_auth_request_handler.h"
+#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_configurator.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_statistics_prefs.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.h"
#include "net/base/load_flags.h"
@@ -74,7 +75,7 @@ DataReductionProxyNetworkDelegate::DataReductionProxyNetworkDelegate(
scoped_ptr<net::NetworkDelegate> network_delegate,
DataReductionProxyParams* params,
DataReductionProxyAuthRequestHandler* handler,
- const ProxyConfigGetter& getter)
+ const DataReductionProxyConfigurator* configurator)
: LayeredNetworkDelegate(network_delegate.Pass()),
ui_task_runner_(NULL),
received_content_length_(0),
@@ -84,7 +85,7 @@ DataReductionProxyNetworkDelegate::DataReductionProxyNetworkDelegate(
data_reduction_proxy_usage_stats_(NULL),
data_reduction_proxy_auth_request_handler_(handler),
data_reduction_proxy_statistics_prefs_(NULL),
- proxy_config_getter_(getter) {
+ configurator_(configurator) {
DCHECK(data_reduction_proxy_params_);
DCHECK(data_reduction_proxy_auth_request_handler_);
}
@@ -92,12 +93,6 @@ DataReductionProxyNetworkDelegate::DataReductionProxyNetworkDelegate(
DataReductionProxyNetworkDelegate::~DataReductionProxyNetworkDelegate() {
}
-void DataReductionProxyNetworkDelegate::InitProxyConfigOverrider(
- const OnResolveProxyHandler& proxy_handler) {
- DCHECK(!proxy_config_getter_.is_null());
- on_resolve_proxy_handler_ = proxy_handler;
-}
-
void DataReductionProxyNetworkDelegate::InitStatisticsPrefsAndUMA(
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
DataReductionProxyStatisticsPrefs* statistics_prefs,
@@ -147,12 +142,9 @@ void DataReductionProxyNetworkDelegate::OnResolveProxyInternal(
int load_flags,
const net::ProxyService& proxy_service,
net::ProxyInfo* result) {
- // TODO(sclittle): Call OnResolveProxyHandler directly, see
- // http://crbug.com/447346.
- if (!on_resolve_proxy_handler_.is_null() &&
- !proxy_config_getter_.is_null()) {
- on_resolve_proxy_handler_.Run(
- url, load_flags, proxy_config_getter_.Run(),
+ if (configurator_) {
+ OnResolveProxyHandler(
+ url, load_flags, configurator_->GetProxyConfigOnIOThread(),
proxy_service.proxy_retry_info(), data_reduction_proxy_params_, result);
}
}
@@ -221,11 +213,11 @@ void DataReductionProxyNetworkDelegate::OnCompletedInternal(
if (data_reduction_proxy_enabled_ &&
data_reduction_proxy_usage_stats_ &&
- !proxy_config_getter_.is_null()) {
+ configurator_) {
data_reduction_proxy_usage_stats_->RecordBytesHistograms(
*request,
*data_reduction_proxy_enabled_,
- proxy_config_getter_.Run());
+ configurator_->GetProxyConfigOnIOThread());
}
DVLOG(2) << __FUNCTION__
<< " received content length: " << received_content_length

Powered by Google App Engine
This is Rietveld 408576698