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/callbacks.h b/callbacks.h
new file mode 100644
index 0000000..4081054
--- /dev/null
+++ b/callbacks.h
@@ -0,0 +1,31 @@
+// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SHILL_CALLBACKS_
+#define SHILL_CALLBACKS_
+
+#include <base/callback.h>
+
+#include "shill/dbus_properties.h"
+
+namespace shill {
+
+class Error;
+// Convenient typedefs for some commonly used callbacks.
+typedef base::Callback<void(const Error &)> ResultCallback;
+typedef base::Callback<void(const Error &)> EnabledStateChangedCallback;
+typedef base::Callback<void(const DBusPropertiesMap &,
+                            const Error &)> DBusPropertyMapCallback;
+typedef base::Callback<void(const std::vector<DBusPropertiesMap> &,
+                            const Error &)> DBusPropertyMapsCallback;
+typedef base::Callback<void(const DBus::Path &,
+                            const Error &)> DBusPathCallback;
+typedef base::Callback<void(
+    const std::vector<DBus::Path> &, const Error &)> DBusPathsCallback;
+typedef base::Callback<void(const std::string &, const Error &)> StringCallback;
+typedef base::Callback<void(
+    uint32, uint32, const DBusPropertiesMap &)> ActivationStateSignalCallback;
+
+}  // namespace shill
+#endif  // SHILL_CALLBACKS_