Make Enable/Disable work using new callbacks for async support.

Use new-style callbacks to implement the Manager EnableTechnology
and DisableTechnology operations asynchronously. This allows
devices to be enabled and disabled from the UI ,and for the UI
to display available networks once the device is enabled.

Removed the behavior whereby setting the Device.Powered property
had the side effect of enabling or disabling the device. To
replace this, I added new Device.Enable and Device.Disable calls
for enabling and disabling individual devices.

Also separated the in-memory value of the Powered property from
the persisted value. Whenever a client requests that a device
be enabled or disabled, the desired power state is immediately
saved in the profile, but the in-memory value isn't updated until
the operation completes. On startup, shill now automatically
starts any devices for which the persistent Powered property
is set, and does not start devices for which it is not set.

BUG=chromium-os:23319,chromium-os:27814
TEST=Manual testing on device + unit tests passing.

Change-Id: Id676be3fc662cfd5efb730c67687edfd16b2dc6b
Reviewed-on: https://gerrit.chromium.org/gerrit/18123
Commit-Ready: Eric Shienbrood <ers@chromium.org>
Reviewed-by: Eric Shienbrood <ers@chromium.org>
Tested-by: Eric Shienbrood <ers@chromium.org>
diff --git a/mm1_modem_modem3gpp_proxy.h b/mm1_modem_modem3gpp_proxy.h
index 2cd72e5..17c015f 100644
--- a/mm1_modem_modem3gpp_proxy.h
+++ b/mm1_modem_modem3gpp_proxy.h
@@ -17,18 +17,19 @@
 class ModemModem3gppProxy : public ModemModem3gppProxyInterface {
  public:
   // Constructs a org.freedesktop.ModemManager1.Modem.Modem3gpp DBus
-  // object proxy at |path| owned by |service|. Caught signals and
-  // asynchronous method replies will be dispatched to |delegate|.
-  ModemModem3gppProxy(ModemModem3gppProxyDelegate *delegate,
-                      DBus::Connection *connection,
+  // object proxy at |path| owned by |service|.
+  ModemModem3gppProxy(DBus::Connection *connection,
                       const std::string &path,
                       const std::string &service);
   virtual ~ModemModem3gppProxy();
   // Inherited methods from ModemModem3gppProxyInterface.
   virtual void Register(const std::string &operator_id,
-                        AsyncCallHandler *call_handler,
+                        Error *error,
+                        const ResultCallback &callback,
                         int timeout);
-  virtual void Scan(AsyncCallHandler *call_handler, int timeout);
+  virtual void Scan(Error *error,
+                    const DBusPropertyMapsCallback &callback,
+                    int timeout);
 
   // Inherited properties from Modem3gppProxyInterface.
   virtual std::string Imei();
@@ -41,8 +42,7 @@
   class Proxy : public org::freedesktop::ModemManager1::Modem::Modem3gpp_proxy,
                 public DBus::ObjectProxy {
    public:
-    Proxy(ModemModem3gppProxyDelegate *delegate,
-          DBus::Connection *connection,
+    Proxy(DBus::Connection *connection,
           const std::string &path,
           const std::string &service);
     virtual ~Proxy();
@@ -54,7 +54,6 @@
     virtual void ScanCallback(
         const std::vector<DBusPropertiesMap> &results,
         const ::DBus::Error& dberror, void *data);
-    ModemModem3gppProxyDelegate *delegate_;
 
     DISALLOW_COPY_AND_ASSIGN(Proxy);
   };