1 // Copyright (c) 2013 Intel Corporation. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "xwalk/application/browser/linux/installed_application_object.h"
8 #include "dbus/message.h"
9 #include "xwalk/application/common/application_data.h"
12 namespace application {
14 // D-Bus Interface implemented by objects that represent installed
20 // Will uninstall the application. This object will be unregistered from
25 // readonly string AppID
26 // readonly string Name
27 const char kInstalledApplicationDBusInterface[] =
28 "org.crosswalkproject.Installed.Application1";
30 const char kInstalledApplicationDBusError[] =
31 "org.crosswalkproject.Installed.Application.Error";
33 InstalledApplicationObject::InstalledApplicationObject(
34 scoped_refptr<dbus::Bus> bus, const dbus::ObjectPath& path,
35 const ApplicationData* app)
36 : dbus::ManagedObject(bus, path),
38 scoped_ptr<base::Value> app_id(base::Value::CreateStringValue(app->ID()));
39 properties()->Set(kInstalledApplicationDBusInterface, "AppID", app_id.Pass());
41 scoped_ptr<base::Value> name(base::Value::CreateStringValue(app->Name()));
42 properties()->Set(kInstalledApplicationDBusInterface, "Name", name.Pass());
45 void InstalledApplicationObject::OnApplicationNameChanged(
46 const std::string& app_name) {
47 scoped_ptr<base::Value> name(base::Value::CreateStringValue(app_name));
48 properties()->Set(kInstalledApplicationDBusInterface, "Name", name.Pass());
51 void InstalledApplicationObject::ExportUninstallMethod(
52 dbus::ExportedObject::MethodCallCallback method_call_callback,
53 dbus::ExportedObject::OnExportedCallback on_exported_callback) {
54 dbus_object()->ExportMethod(
55 kInstalledApplicationDBusInterface, "Uninstall",
56 method_call_callback, on_exported_callback);
59 } // namespace application