AU: Beginnings of dbus support.
The AU will be a daemon that runs as root. Non-root will communicate
via dbus with the updater to do things such as: query status, request
forced or full updates, etc.
New files for dbus:
UpdateEngine.conf - security configuration
dbus_constants.h - common constants
dbus_service.* - The object exposed over dbus
org.chromium.UpdateEngine.service - the dbus service file
udpate_attempter.* - Refactored this out of main.cc
update_engine_client.cc - Simple command line utility to interact with
Update Engine over dbus. Whereas Update Engine runs as root, this tool
runs as non-root user.
Review URL: http://codereview.chromium.org/1733013
diff --git a/update_attempter.h b/update_attempter.h
new file mode 100644
index 0000000..83e4737
--- /dev/null
+++ b/update_attempter.h
@@ -0,0 +1,54 @@
+// Copyright (c) 2010 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 CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_ATTEMPTER_H__
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_ATTEMPTER_H__
+
+#include <tr1/memory>
+#include <string>
+#include <vector>
+#include <glib.h>
+#include "update_engine/action_processor.h"
+#include "update_engine/omaha_response_handler_action.h"
+
+namespace chromeos_update_engine {
+
+class UpdateAttempter : public ActionProcessorDelegate {
+ public:
+ explicit UpdateAttempter(GMainLoop *loop)
+ : full_update_(false),
+ loop_(loop) {}
+ void Update(bool force_full_update);
+
+ // Delegate method:
+ void ProcessingDone(const ActionProcessor* processor, bool success);
+
+ // Stop updating. An attempt will be made to record status to the disk
+ // so that updates can be resumed later.
+ void Terminate();
+
+ // Try to resume from a previously Terminate()d update.
+ void ResumeUpdating();
+
+ // Returns the current status in the out params. Returns true on success.
+ bool GetStatus(int64_t* last_checked_time,
+ double* progress,
+ std::string* current_operation,
+ std::string* new_version,
+ int64_t* new_size);
+
+ private:
+ bool full_update_;
+ std::vector<std::tr1::shared_ptr<AbstractAction> > actions_;
+ ActionProcessor processor_;
+ GMainLoop *loop_;
+
+ // pointer to the OmahaResponseHandlerAction in the actions_ vector;
+ std::tr1::shared_ptr<OmahaResponseHandlerAction> response_handler_action_;
+ DISALLOW_COPY_AND_ASSIGN(UpdateAttempter);
+};
+
+} // namespace chromeos_update_engine
+
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_ATTEMPTER_H__