Popular sites on the NTP: check that experiment group StartsWith (rather than IS...
[chromium-blink-merge.git] / chrome / browser / chromeos / dbus / screen_lock_service_provider.h
bloba2c282b8fbc440daa11ebc4145f737dba8d6559f
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_
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 "chromeos/dbus/services/cros_dbus_service.h"
15 #include "dbus/exported_object.h"
17 namespace dbus {
18 class MethodCall;
21 namespace chromeos {
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 {
27 public:
28 ScreenLockServiceProvider();
29 ~ScreenLockServiceProvider() override;
31 // CrosDBusService::ServiceProviderInterface overrides:
32 void Start(scoped_refptr<dbus::ExportedObject> exported_object) override;
34 private:
35 // Called from ExportedObject when a handler is exported as a D-Bus
36 // method or failed to be exported.
37 void OnExported(const std::string& interface_name,
38 const std::string& method_name,
39 bool success);
41 // Called on UI thread in response to D-Bus requests.
42 void LockScreen(dbus::MethodCall* method_call,
43 dbus::ExportedObject::ResponseSender response_sender);
45 // Keep this last so that all weak pointers will be invalidated at the
46 // beginning of destruction.
47 base::WeakPtrFactory<ScreenLockServiceProvider> weak_ptr_factory_;
49 DISALLOW_COPY_AND_ASSIGN(ScreenLockServiceProvider);
52 } // namespace chromeos
54 #endif // CHROME_BROWSER_CHROMEOS_DBUS_SCREEN_LOCK_SERVICE_PROVIDER_H_