Add the NetworkQualityEstimator class that is notified
when net stack receives data.

Expose PeakKbps and FastestRTT Statistics through
GetEstimate() API which may be used by clients like Lo-Fi.

PeakKbps and FastestRTT computation is now
based on prefilter bytes which correctly
represent the amount of data that was transferred
over the wire.

BUG=472678, 478162

Review URL: https://codereview.chromium.org/1061583002

Cr-Commit-Position: refs/heads/master@{#331192}
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index 46d0e3e8..0a306c7c 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -48,6 +48,7 @@
 #include "content/public/browser/cookie_store_factory.h"
 #include "net/base/host_mapping_rules.h"
 #include "net/base/net_util.h"
+#include "net/base/network_quality_estimator.h"
 #include "net/base/sdch_manager.h"
 #include "net/cert/cert_policy_enforcer.h"
 #include "net/cert/cert_verifier.h"
@@ -275,6 +276,8 @@
   context->set_network_delegate(globals->system_network_delegate.get());
   context->set_http_user_agent_settings(
       globals->http_user_agent_settings.get());
+  context->set_network_quality_estimator(
+      globals->network_quality_estimator.get());
   return context;
 }
 
@@ -670,6 +673,9 @@
           "466432 IOThread::InitAsync::CreateGlobalHostResolver"));
   globals_->system_network_delegate = chrome_network_delegate.Pass();
   globals_->host_resolver = CreateGlobalHostResolver(net_log_);
+
+  globals_->network_quality_estimator.reset(new net::NetworkQualityEstimator());
+
   // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432
   // is fixed.
   tracked_objects::ScopedTracker tracking_profile5(