- update source.
[platform/framework/web/crosswalk.git] / src / xwalk / application / browser / linux / running_application_object.h
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.
4
5 #ifndef XWALK_APPLICATION_BROWSER_LINUX_RUNNING_APPLICATION_OBJECT_H_
6 #define XWALK_APPLICATION_BROWSER_LINUX_RUNNING_APPLICATION_OBJECT_H_
7
8 #include <string>
9 #include "base/memory/ref_counted.h"
10 #include "xwalk/dbus/object_manager_adaptor.h"
11
12 namespace dbus {
13 class Bus;
14 }
15
16 namespace xwalk {
17 namespace application {
18
19 class Application;
20
21 class RunningApplicationObject : public dbus::ManagedObject {
22  public:
23   RunningApplicationObject(scoped_refptr<dbus::Bus> bus,
24                            const std::string& app_id,
25                            const std::string& launcher_name,
26                            Application* application);
27
28   ~RunningApplicationObject();
29
30  private:
31   void TerminateApplication();
32
33   void OnExported(const std::string& interface_name,
34                   const std::string& method_name,
35                   bool success);
36
37   void OnTerminate(dbus::MethodCall* method_call,
38                    dbus::ExportedObject::ResponseSender response_sender);
39
40   void OnNameOwnerChanged(const std::string& service_owner);
41
42   void OnLauncherDisappeared();
43
44   scoped_refptr<dbus::Bus> bus_;
45   std::string launcher_name_;
46   Application* application_;
47   bool watching_launcher_;
48 };
49
50 }  // namespace application
51 }  // namespace xwalk
52
53 #endif  // XWALK_APPLICATION_BROWSER_LINUX_RUNNING_APPLICATION_OBJECT_H_
54