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_RUNNING_APPLICATIONS_MANAGER_H_
6 #define XWALK_APPLICATION_BROWSER_LINUX_RUNNING_APPLICATIONS_MANAGER_H_
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_vector.h"
11 #include "base/memory/weak_ptr.h"
12 #include "xwalk/application/browser/application_service.h"
13 #include "xwalk/dbus/object_manager_adaptor.h"
16 namespace application {
18 class RunningApplicationObject;
21 dbus::ObjectPath GetRunningPathForAppID(const std::string& app_id);
23 // Holds the D-Bus representation of the set of installed applications. This is
24 // the entry point for launching applications and listing currently running
27 // The exported object implements org.freedesktop.DBus.ObjectManager, and the
28 // interface org.crosswalkproject.Installed.Manager1 (see .cc file for
30 class RunningApplicationsManager : public ApplicationService::Observer {
32 RunningApplicationsManager(scoped_refptr<dbus::Bus> bus,
33 ApplicationService* service);
34 virtual ~RunningApplicationsManager();
36 RunningApplicationObject* GetRunningApp(const std::string& app_id);
39 // org.crosswalkproject.Running.Manager1 interface.
40 void OnLaunch(dbus::MethodCall* method_call,
41 dbus::ExportedObject::ResponseSender response_sender);
43 void OnExported(const std::string& interface_name,
44 const std::string& method_name,
47 void virtual WillDestroyApplication(Application* app) OVERRIDE;
49 dbus::ObjectPath AddObject(const std::string& app_id,
50 const std::string& launcher_name,
51 Application* application);
53 base::WeakPtrFactory<RunningApplicationsManager> weak_factory_;
54 ApplicationService* application_service_;
55 dbus::ObjectManagerAdaptor adaptor_;
58 } // namespace application
61 #endif // XWALK_APPLICATION_BROWSER_LINUX_RUNNING_APPLICATIONS_MANAGER_H_