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 OnApplicationUpdated(const std::string& app_id) OVERRIDE;
38 void virtual OnApplicationNameChanged(const std::string& app_id,
39 const std::string& app_name) OVERRIDE;
41 void AddInitialObjects();
42 void AddObject(scoped_refptr<const ApplicationData> app);
45 dbus::MethodCall* method_call,
46 dbus::ExportedObject::ResponseSender response_sender);
48 InstalledApplicationObject* installed_app_object,
49 dbus::MethodCall* method_call,
50 dbus::ExportedObject::ResponseSender response_sender);
52 void OnExported(const std::string& interface_name,
53 const std::string& method_name,
56 base::WeakPtrFactory<InstalledApplicationsManager> weak_factory_;
57 ApplicationService* application_service_;
58 ApplicationStorage* app_storage_;
59 dbus::ObjectManagerAdaptor adaptor_;
62 } // namespace application
65 #endif // XWALK_APPLICATION_BROWSER_LINUX_INSTALLED_APPLICATIONS_MANAGER_H_