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 #ifndef XWALK_APPLICATION_BROWSER_LINUX_INSTALLED_APPLICATIONS_MANAGER_H_
6 #define XWALK_APPLICATION_BROWSER_LINUX_INSTALLED_APPLICATIONS_MANAGER_H_
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/weak_ptr.h"
11 #include "xwalk/application/browser/application_service.h"
12 #include "xwalk/dbus/object_manager_adaptor.h"
15 namespace application {
17 class InstalledApplicationObject;
19 // Holds the D-Bus representation of the set of installed applications. This is
20 // the entry point for listing, installing and uninstalling applications via
23 // The exported object implements org.freedesktop.DBus.ObjectManager, and the
24 // interface org.crosswalkproject.Installed.Manager1 (see .cc file for
26 class InstalledApplicationsManager : public ApplicationService::Observer {
28 InstalledApplicationsManager(scoped_refptr<dbus::Bus> bus,
29 ApplicationService* service,
30 ApplicationStorage* app_storage);
31 virtual ~InstalledApplicationsManager();
34 // ApplicationService::Observer implementation.
35 void virtual OnApplicationInstalled(const std::string& app_id) OVERRIDE;
36 void virtual OnApplicationUninstalled(const std::string& app_id) OVERRIDE;
37 void virtual OnApplicationNameChanged(const std::string& app_id,
38 const std::string& app_name) OVERRIDE;
40 void AddInitialObjects();
41 void AddObject(scoped_refptr<const ApplicationData> app);
44 dbus::MethodCall* method_call,
45 dbus::ExportedObject::ResponseSender response_sender);
47 InstalledApplicationObject* installed_app_object,
48 dbus::MethodCall* method_call,
49 dbus::ExportedObject::ResponseSender response_sender);
51 void OnExported(const std::string& interface_name,
52 const std::string& method_name,
55 base::WeakPtrFactory<InstalledApplicationsManager> weak_factory_;
56 ApplicationService* application_service_;
57 ApplicationStorage* app_storage_;
58 dbus::ObjectManagerAdaptor adaptor_;
61 } // namespace application
64 #endif // XWALK_APPLICATION_BROWSER_LINUX_INSTALLED_APPLICATIONS_MANAGER_H_