Observe the current configuration from DataReductionProxyURLLoaderThrottle.

Bug: 721403

Change-Id: I6f23e6ba1099666be58014efa840829a072b097c
Reviewed-on: https://chromium-review.googlesource.com/c/1347432
Reviewed-by: rajendrant <[email protected]>
Reviewed-by: Scott Violet <[email protected]>
Reviewed-by: Tom Sepez <[email protected]>
Reviewed-by: Clark DuVall <[email protected]>
Commit-Queue: Eric Roman <[email protected]>
Cr-Commit-Position: refs/heads/master@{#611968}
diff --git a/chrome/renderer/url_loader_throttle_provider_impl.cc b/chrome/renderer/url_loader_throttle_provider_impl.cc
index 5fc0f0c0..b8249af 100644
--- a/chrome/renderer/url_loader_throttle_provider_impl.cc
+++ b/chrome/renderer/url_loader_throttle_provider_impl.cc
@@ -18,6 +18,7 @@
 #include "chrome/renderer/prerender/prerender_helper.h"
 #include "components/data_reduction_proxy/content/common/data_reduction_proxy_url_loader_throttle.h"
 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h"
+#include "components/data_reduction_proxy/core/common/data_reduction_proxy_throttle_manager.h"
 #include "components/safe_browsing/features.h"
 #include "components/safe_browsing/renderer/renderer_url_loader_throttle.h"
 #include "components/subresource_filter/content/renderer/ad_delay_renderer_metadata_provider.h"
@@ -120,9 +121,14 @@
   }
 
   if (data_reduction_proxy::params::IsEnabledWithNetworkService()) {
+    data_reduction_proxy::mojom::DataReductionProxyPtr drp;
     content::RenderThread::Get()->GetConnector()->BindInterface(
-        content::mojom::kBrowserServiceName,
-        mojo::MakeRequest(&data_reduction_proxy_));
+        content::mojom::kBrowserServiceName, mojo::MakeRequest(&drp));
+
+    data_reduction_proxy_manager_ = std::make_unique<
+        data_reduction_proxy::DataReductionProxyThrottleManager>(
+        std::move(drp),
+        data_reduction_proxy::mojom::DataReductionProxyThrottleConfigPtr());
   }
 }
 
@@ -137,9 +143,9 @@
   DETACH_FROM_THREAD(thread_checker_);
   if (other.safe_browsing_)
     other.safe_browsing_->Clone(mojo::MakeRequest(&safe_browsing_info_));
-  if (other.data_reduction_proxy_) {
-    other.data_reduction_proxy_->Clone(
-        mojo::MakeRequest(&data_reduction_proxy_));
+  if (other.data_reduction_proxy_manager_) {
+    data_reduction_proxy_manager_ =
+        other.data_reduction_proxy_manager_->Clone();
   }
   // An ad_delay_factory_ is created, rather than cloning the existing one.
 }
@@ -170,11 +176,11 @@
   DCHECK(!is_frame_resource ||
          type_ == content::URLLoaderThrottleProviderType::kFrame);
 
-  if (data_reduction_proxy::params::IsEnabledWithNetworkService()) {
+  if (data_reduction_proxy_manager_) {
     throttles.push_back(
         std::make_unique<
             data_reduction_proxy::DataReductionProxyURLLoaderThrottle>(
-            net::HttpRequestHeaders(), data_reduction_proxy_.get()));
+            net::HttpRequestHeaders(), data_reduction_proxy_manager_.get()));
   }
 
   if ((network_service_enabled ||