shill: Installs progressive scan in shill.

BUG=chromium:222088
TEST=unittest and manual.  The manual tests consist of:
  - Enable progressive scan.  On target, in a crosh window, do:
      o progressive_scan on
  - Start shill with log=-10/wifi.  On the target, in a shell window,
    do the following:
      o stop shill
      o shill --log-level=-10 --log-scopes=wifi
  - Wait five seconds (the code will do everything it needs to at
    startup).
  - Look in /var/log/net.log and verify the existence of the following:
      o Doing progressive scan

      o ProgressiveScanTask - scan requested for XXXX
        Initiating a scan -- returning

      o ProgressiveScanTask - scan requested for XXXX
        Ignoring scan request wile connecting to an AP

Change-Id: Ie577869aedc03230e1fab62fc8cb9f0b3850c7fb
Reviewed-on: https://gerrit.chromium.org/gerrit/50377
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: Wade Guthrie <wdg@chromium.org>
Reviewed-by: Wade Guthrie <wdg@chromium.org>
Tested-by: Wade Guthrie <wdg@chromium.org>
diff --git a/wifi.h b/wifi.h
index 6639828..2dfadad 100644
--- a/wifi.h
+++ b/wifi.h
@@ -103,6 +103,7 @@
 class NetlinkManager;
 class NetlinkMessage;
 class ProxyFactory;
+class ScanSession;
 class SupplicantEAPStateHandler;
 class SupplicantInterfaceProxyInterface;
 class SupplicantProcessProxyInterface;
@@ -222,6 +223,8 @@
   static const int kFastScanIntervalSeconds;
   static const int kPendingTimeoutSeconds;
   static const int kReconnectTimeoutSeconds;
+  static const size_t kMinumumFrequenciesToScan;
+  static const char kProgressiveScanFlagFile[];
 
   // Gets the list of frequencies supported by this device.
   void ConfigureScanFrequencies();
@@ -300,6 +303,10 @@
   // with the reason for failure.
   virtual bool RemoveNetworkForService(
       const WiFiService *service, Error *error);
+  // Perform the next in a series of progressive scans.
+  void ProgressiveScanTask();
+  // Recovers from failed progressive scan.
+  void OnFailedProgressiveScan();
   // Restart fast scanning after disconnection.
   void RestartFastScanAttempts();
   // Schedules a scan attempt at time |scan_interval_seconds_| in the
@@ -410,8 +417,12 @@
   bool scan_pending_;
   uint16 scan_interval_seconds_;
 
+  bool progressive_scan_enabled_;
   NetlinkManager *netlink_manager_;
   std::set<uint16_t> all_scan_frequencies_;
+  scoped_ptr<ScanSession> scan_session_;
+  size_t min_frequencies_to_scan_;
+  size_t max_frequencies_to_scan_;
 
   DISALLOW_COPY_AND_ASSIGN(WiFi);
 };