AU: Provide a reboot_if_needed D-Bus API.

This will reboot if the current state is UPDATED_REBOOT_NEEDED.
Also add -reboot option to the update_engine_client.

BUG=4250
TEST=unit tests,gmerged on device and tried reboot requests

Review URL: http://codereview.chromium.org/3034026
diff --git a/dbus_service.cc b/dbus_service.cc
index 54dde41..4a05160 100644
--- a/dbus_service.cc
+++ b/dbus_service.cc
@@ -47,6 +47,24 @@
       g_object_new(UPDATE_ENGINE_TYPE_SERVICE, NULL));
 }
 
+gboolean update_engine_service_attempt_update(UpdateEngineService* self,
+                                              gchar* app_version,
+                                              gchar* omaha_url,
+                                              GError **error) {
+  const string update_app_version = app_version ? app_version : "";
+  const string update_omaha_url = omaha_url ? omaha_url : "";
+  LOG(INFO) << "Attempt update: app_version=\"" << update_app_version << "\" "
+            << "omaha_url=\"" << update_omaha_url << "\"";
+  self->update_attempter_->CheckForUpdate(app_version, omaha_url);
+  return TRUE;
+}
+
+gboolean update_engine_service_check_for_update(UpdateEngineService* self,
+                                                GError **error) {
+  self->update_attempter_->CheckForUpdate("", "");
+  return TRUE;
+}
+
 gboolean update_engine_service_get_status(UpdateEngineService* self,
                                           int64_t* last_checked_time,
                                           double* progress,
@@ -68,21 +86,12 @@
   return TRUE;
 }
 
-gboolean update_engine_service_attempt_update(UpdateEngineService* self,
-                                              gchar* app_version,
-                                              gchar* omaha_url,
-                                              GError **error) {
-  const string update_app_version = app_version ? app_version : "";
-  const string update_omaha_url = omaha_url ? omaha_url : "";
-  LOG(INFO) << "Attempt update: app_version=\"" << update_app_version << "\" "
-            << "omaha_url=\"" << update_omaha_url << "\"";
-  self->update_attempter_->CheckForUpdate(app_version, omaha_url);
-  return TRUE;
-}
-
-gboolean update_engine_service_check_for_update(UpdateEngineService* self,
+gboolean update_engine_service_reboot_if_needed(UpdateEngineService* self,
                                                 GError **error) {
-  self->update_attempter_->CheckForUpdate("", "");
+  if (!self->update_attempter_->RebootIfNeeded()) {
+    *error = NULL;
+    return FALSE;
+  }
   return TRUE;
 }