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

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 comment from mmenke Created 6 years 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 2590da02b6cc2dac4efb2a1f33634f576b1c5454..a2d6c6bae6cbe7f419c961bccd2119c92c849f5d 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_protocol.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"
@@ -72,7 +73,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),
@@ -82,7 +83,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,7 +93,7 @@ DataReductionProxyNetworkDelegate::~DataReductionProxyNetworkDelegate() {
void DataReductionProxyNetworkDelegate::InitProxyConfigOverrider(
const OnResolveProxyHandler& proxy_handler) {
- DCHECK(!proxy_config_getter_.is_null());
+ DCHECK(configurator_);
on_resolve_proxy_handler_ = proxy_handler;
}
@@ -145,11 +146,11 @@ void DataReductionProxyNetworkDelegate::OnResolveProxyInternal(
int load_flags,
const net::ProxyService& proxy_service,
net::ProxyInfo* result) {
- if (!on_resolve_proxy_handler_.is_null() &&
- !proxy_config_getter_.is_null()) {
+ if (!on_resolve_proxy_handler_.is_null() && configurator_) {
on_resolve_proxy_handler_.Run(
- url, load_flags, proxy_config_getter_.Run(), proxy_service.config(),
- proxy_service.proxy_retry_info(), data_reduction_proxy_params_, result);
+ url, load_flags, configurator_->GetProxyConfigOnIOThread(),
+ proxy_service.config(), proxy_service.proxy_retry_info(),
+ data_reduction_proxy_params_, result);
}
}
@@ -215,11 +216,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