Fix infinite recursion on hiding panel when created during fullscreen mode.
[chromium-blink-merge.git] / chrome / browser / chromeos / dbus / liveness_service_provider.h
blobc18e1181305267fc971efce9b9517a9f48139938
1 // Copyright (c) 2012 The Chromium Authors. 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 CHROME_BROWSER_CHROMEOS_DBUS_LIVENESS_SERVICE_PROVIDER_H_
6 #define CHROME_BROWSER_CHROMEOS_DBUS_LIVENESS_SERVICE_PROVIDER_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/memory/weak_ptr.h"
14 #include "chrome/browser/chromeos/dbus/cros_dbus_service.h"
15 #include "dbus/exported_object.h"
17 namespace dbus {
18 class MethodCall;
19 class Response;
22 namespace chromeos {
24 // This class exports a "CheckLiveness" D-Bus method that the session manager
25 // calls periodically to confirm that Chrome's UI thread is responsive to D-Bus
26 // messages. It can be tested with the following command:
28 // % dbus-send --system --type=method_call --print-reply
29 // --dest=org.chromium.LibCrosService
30 // /org/chromium/LibCrosService
31 // org.chromium.LibCrosServiceInterface.CheckLiveness
33 // -> method return sender=:1.9 -> dest=:1.27 reply_serial=2
35 // (An empty response should be returned.)
36 class LivenessServiceProvider
37 : public CrosDBusService::ServiceProviderInterface {
38 public:
39 LivenessServiceProvider();
40 virtual ~LivenessServiceProvider();
42 // CrosDBusService::ServiceProviderInterface overrides:
43 virtual void Start(
44 scoped_refptr<dbus::ExportedObject> exported_object) OVERRIDE;
46 private:
47 // Called from ExportedObject when CheckLiveness() is exported as a D-Bus
48 // method or failed to be exported.
49 void OnExported(const std::string& interface_name,
50 const std::string& method_name,
51 bool success);
53 // Called on UI thread in response to a D-Bus request.
54 void CheckLiveness(dbus::MethodCall* method_call,
55 dbus::ExportedObject::ResponseSender response_sender);
57 // Keep this last so that all weak pointers will be invalidated at the
58 // beginning of destruction.
59 base::WeakPtrFactory<LivenessServiceProvider> weak_ptr_factory_;
61 DISALLOW_COPY_AND_ASSIGN(LivenessServiceProvider);
64 } // namespace chromeos
66 #endif // CHROME_BROWSER_CHROMEOS_DBUS_LIVENESS_SERVICE_PROVIDER_H_