Index: src/platform/update_engine/dbus_service.cc |
diff --git a/src/platform/update_engine/dbus_service.cc b/src/platform/update_engine/dbus_service.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8dc239f520ce17c69405d6164adf3bc7cc7586aa |
--- /dev/null |
+++ b/src/platform/update_engine/dbus_service.cc |
@@ -0,0 +1,51 @@ |
+// 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. |
+ |
+#include "update_engine/dbus_service.h" |
+#include <string> |
+#include "base/logging.h" |
+ |
+using std::string; |
+ |
+G_DEFINE_TYPE(UpdateEngineService, update_engine_service, G_TYPE_OBJECT) |
+ |
+static void update_engine_service_finalize(GObject* object) { |
+ G_OBJECT_CLASS(update_engine_service_parent_class)->finalize(object); |
+} |
+ |
+static void update_engine_service_class_init(UpdateEngineServiceClass* klass) { |
+ GObjectClass *object_class; |
+ object_class = G_OBJECT_CLASS(klass); |
+ object_class->finalize = update_engine_service_finalize; |
+} |
+ |
+static void update_engine_service_init(UpdateEngineService* object) { |
+} |
+ |
+UpdateEngineService* update_engine_service_new(void) { |
+ return reinterpret_cast<UpdateEngineService*>( |
+ g_object_new(UPDATE_ENGINE_TYPE_SERVICE, NULL)); |
+} |
+ |
+gboolean update_engine_service_get_status(UpdateEngineService* self, |
+ int64_t* last_checked_time, |
+ double* progress, |
+ gchar** current_operation, |
+ gchar** new_version, |
+ int64_t* new_size, |
+ GError **error) { |
+ string current_op; |
+ string new_version_str; |
+ |
+ CHECK(self->update_attempter_->GetStatus(last_checked_time, |
+ progress, |
+ ¤t_op, |
+ &new_version_str, |
+ new_size)); |
+ |
+ *current_operation = strdup(current_op.c_str()); |
+ *new_version = strdup(new_version_str.c_str()); |
+ return TRUE; |
+} |
+ |