blob: 8dc239f520ce17c69405d6164adf3bc7cc7586aa [file] [log] [blame]
// 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,
&current_op,
&new_version_str,
new_size));
*current_operation = strdup(current_op.c_str());
*new_version = strdup(new_version_str.c_str());
return TRUE;
}