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 #include "chrome/browser/chromeos/dbus/screen_lock_service_provider.h"
8 #include "ash/wm/lock_state_controller.h"
10 #include "chrome/browser/chromeos/login/lock/screen_locker.h"
12 #include "dbus/message.h"
13 #include "third_party/cros_system_api/dbus/service_constants.h"
17 ScreenLockServiceProvider::ScreenLockServiceProvider()
18 : weak_ptr_factory_(this) {
21 ScreenLockServiceProvider::~ScreenLockServiceProvider() {}
23 void ScreenLockServiceProvider::Start(
24 scoped_refptr
<dbus::ExportedObject
> exported_object
) {
25 exported_object
->ExportMethod(
26 kLibCrosServiceInterface
,
28 base::Bind(&ScreenLockServiceProvider::LockScreen
,
29 weak_ptr_factory_
.GetWeakPtr()),
30 base::Bind(&ScreenLockServiceProvider::OnExported
,
31 weak_ptr_factory_
.GetWeakPtr()));
34 void ScreenLockServiceProvider::OnExported(const std::string
& interface_name
,
35 const std::string
& method_name
,
38 LOG(ERROR
) << "Failed to export " << interface_name
<< "."
43 void ScreenLockServiceProvider::LockScreen(
44 dbus::MethodCall
* method_call
,
45 dbus::ExportedObject::ResponseSender response_sender
) {
46 // Please add any additional logic to ScreenLocker::HandleLockScreenRequest()
47 // instead of placing it here.
48 ScreenLocker::HandleLockScreenRequest();
49 response_sender
.Run(dbus::Response::FromMethodCall(method_call
));
52 } // namespace chromeos