1 // Copyright 2014 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_SCREEN_LOCK_SERVICE_PROVIDER_H_
6 #define CHROME_BROWSER_CHROMEOS_DBUS_SCREEN_LOCK_SERVICE_PROVIDER_H_
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 "chromeos/dbus/services/cros_dbus_service.h"
15 #include "dbus/exported_object.h"
23 // This class exports a "LockScreen" D-Bus methods that the session manager
24 // calls to instruct Chrome to lock the screen.
25 class ScreenLockServiceProvider
26 : public CrosDBusService::ServiceProviderInterface
{
28 ScreenLockServiceProvider();
29 virtual ~ScreenLockServiceProvider();
31 // CrosDBusService::ServiceProviderInterface overrides:
33 scoped_refptr
<dbus::ExportedObject
> exported_object
) override
;
36 // Called from ExportedObject when a handler is exported as a D-Bus
37 // method or failed to be exported.
38 void OnExported(const std::string
& interface_name
,
39 const std::string
& method_name
,
42 // Called on UI thread in response to D-Bus requests.
43 void LockScreen(dbus::MethodCall
* method_call
,
44 dbus::ExportedObject::ResponseSender response_sender
);
46 // Keep this last so that all weak pointers will be invalidated at the
47 // beginning of destruction.
48 base::WeakPtrFactory
<ScreenLockServiceProvider
> weak_ptr_factory_
;
50 DISALLOW_COPY_AND_ASSIGN(ScreenLockServiceProvider
);
53 } // namespace chromeos
55 #endif // CHROME_BROWSER_CHROMEOS_DBUS_SCREEN_LOCK_SERVICE_PROVIDER_H_