shill: cellular: Migrate |ParseScanResult| to use MobileOperatorInfo.

|CellularCapabilityUniversal::ParseScanResult| and
|CellularCapabilityGSM::ParseScanResult| were the last uses of
|mobile_provider_db|. This CL migrates these function to use the new
|MobileOperatorInfo| objects. With this, we no longer depend on
mobile_provider_db.

BUG=chromium:371630
TEST=- Test a user initiated scan request works correctly on e362, Gobi3K UMTS.
     - Test that user initiated scan works correctly when the operator name is
       not available from the modem. This situation can be simulated as follows:
         $ run_pseudomodem.py &
         $ connectivity show devices
       Verify that the 'Cellular.FoundNetworks' is absent from
       /device/pseudomodem0
         $ dbus-send --system --dest=org.freedesktop.ModemManager1 \
             /org/freedesktop/ModemManager1/SIM/0 \
             org.freedesktop.DBus.Properties.Set \
             string:'org.freedesktop.ModemManager1.Sim' \
             string:'OperatorName' variant:string:''
         $ dbus-send --system --dest=org.freedesktop.ModemManager1 \
             /org/freedesktop/ModemManager1/Modem/0 \
             org.freedesktop.DBus.Properties.Set \
             string:'org.freedesktop.ModemManager1.Modem.Modem3gpp' \
             string:'OperatorName' variant:string:''
         $ dbus-send --system --dest=org.chromium.flimflam \
             /device/pseudomodem0 org.chromium.flimflam.Device.ProposeScan
       Verify that the 'Cellular.FoundNetworks' is present and has the
       'long_name' populated.

Change-Id: I340217acb700eb1c8253c88c1b75851880033160
Reviewed-on: https://chromium-review.googlesource.com/200681
Reviewed-by: Thieu Le <thieule@chromium.org>
Commit-Queue: Prathmesh Prabhu <pprabhu@chromium.org>
Tested-by: Prathmesh Prabhu <pprabhu@chromium.org>
diff --git a/cellular_capability_universal.cc b/cellular_capability_universal.cc
index f4356db..61484d3 100644
--- a/cellular_capability_universal.cc
+++ b/cellular_capability_universal.cc
@@ -132,6 +132,8 @@
     ProxyFactory *proxy_factory,
     ModemInfo *modem_info)
     : CellularCapability(cellular, proxy_factory, modem_info),
+      mobile_operator_info_(new MobileOperatorInfo(cellular->dispatcher(),
+                                                   "ParseScanResult")),
       weak_ptr_factory_(this),
       registration_state_(MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN),
       current_capabilities_(MM_MODEM_CAPABILITY_NONE),
@@ -145,6 +147,7 @@
       registration_dropped_update_timeout_milliseconds_(
           kRegistrationDroppedUpdateTimeoutMilliseconds) {
   SLOG(Cellular, 2) << "Cellular capability constructed: Universal";
+  mobile_operator_info_->Init();
   HelpRegisterConstDerivedKeyValueStore(
       kSIMLockStatusProperty,
       &CellularCapabilityUniversal::SimLockStatusToProperty);
@@ -1128,15 +1131,11 @@
   if ((!ContainsKey(parsed, kLongNameProperty) ||
        parsed[kLongNameProperty].empty()) &&
       ContainsKey(parsed, kNetworkIdProperty)) {
-    mobile_provider *provider =
-        mobile_provider_lookup_by_network(
-            modem_info()->provider_db(),
-            parsed[kNetworkIdProperty].c_str());
-    if (provider) {
-      const char *long_name = mobile_provider_get_name(provider);
-      if (long_name && *long_name) {
-        parsed[kLongNameProperty] = long_name;
-      }
+    mobile_operator_info_->Reset();
+    mobile_operator_info_->UpdateMCCMNC(parsed[kNetworkIdProperty]);
+    if (mobile_operator_info_->IsMobileNetworkOperatorKnown() &&
+        !mobile_operator_info_->operator_name().empty()) {
+      parsed[kLongNameProperty] = mobile_operator_info_->operator_name();
     }
   }
   return parsed;