Network Error Logging: Set up in URLRequestContextBuilder.

Now that Reporting has moved into //net, set it up in URLRequestContextBuilder. Also, be more aggressive about ifdef-ing out Reporting and NEL code when Reporting is disabled.

Bug: 
Change-Id: I1ae72d8279d128e59d3edfd1d37844ee7b9a1ee1
Reviewed-on: https://chromium-review.googlesource.com/775756
Reviewed-by: Matt Menke <[email protected]>
Commit-Queue: Julia Tuttle <[email protected]>
Cr-Commit-Position: refs/heads/master@{#517945}
diff --git a/net/url_request/url_request_context.h b/net/url_request/url_request_context.h
index f21ba46b..c498ad2 100644
--- a/net/url_request/url_request_context.h
+++ b/net/url_request/url_request_context.h
@@ -22,6 +22,7 @@
 #include "net/http/http_network_session.h"
 #include "net/http/http_server_properties.h"
 #include "net/http/transport_security_state.h"
+#include "net/net_features.h"
 #include "net/ssl/ssl_config_service.h"
 #include "net/traffic_annotation/network_traffic_annotation.h"
 #include "net/url_request/url_request.h"
@@ -44,14 +45,17 @@
 class HttpUserAgentSettings;
 class NetLog;
 class NetworkDelegate;
-class NetworkErrorLoggingDelegate;
 class NetworkQualityEstimator;
-class ReportingService;
 class ProxyService;
 class URLRequest;
 class URLRequestJobFactory;
 class URLRequestThrottlerManager;
 
+#if BUILDFLAG(ENABLE_REPORTING)
+class NetworkErrorLoggingDelegate;
+class ReportingService;
+#endif  // BUILDFLAG(ENABLE_REPORTING)
+
 // Subclass to provide application-specific context for URLRequest
 // instances. URLRequestContext does not own these member variables, since they
 // may be shared with other contexts. URLRequestContextStorage can be used for
@@ -244,6 +248,7 @@
     network_quality_estimator_ = network_quality_estimator;
   }
 
+#if BUILDFLAG(ENABLE_REPORTING)
   ReportingService* reporting_service() const { return reporting_service_; }
   void set_reporting_service(ReportingService* reporting_service) {
     reporting_service_ = reporting_service;
@@ -256,6 +261,7 @@
       NetworkErrorLoggingDelegate* network_error_logging_delegate) {
     network_error_logging_delegate_ = network_error_logging_delegate;
   }
+#endif  // BUILDFLAG(ENABLE_REPORTING)
 
   void set_enable_brotli(bool enable_brotli) { enable_brotli_ = enable_brotli; }
 
@@ -312,8 +318,10 @@
   const URLRequestJobFactory* job_factory_;
   URLRequestThrottlerManager* throttler_manager_;
   NetworkQualityEstimator* network_quality_estimator_;
+#if BUILDFLAG(ENABLE_REPORTING)
   ReportingService* reporting_service_;
   NetworkErrorLoggingDelegate* network_error_logging_delegate_;
+#endif  // BUILDFLAG(ENABLE_REPORTING)
 
   // ---------------------------------------------------------------------------
   // Important: When adding any new members below, consider whether they need to