| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/power/power_button_observer.h" | 5 #include "chrome/browser/chromeos/power/power_button_observer.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/system/user/login_status.h" | 8 #include "ash/system/user/login_status.h" |
| 9 #include "ash/wm/power_button_controller.h" | 9 #include "ash/wm/power_button_controller.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "chrome/browser/chromeos/login/screen_locker.h" | 11 #include "chrome/browser/chromeos/login/screen_locker.h" |
| 12 #include "chrome/browser/chromeos/login/user.h" | 12 #include "chrome/browser/chromeos/login/user.h" |
| 13 #include "chrome/browser/chromeos/login/user_manager.h" | 13 #include "chrome/browser/chromeos/login/user_manager.h" |
| 14 #include "chrome/browser/chromeos/power/power_button_controller_delegate_chromeo
s.h" | 14 #include "chrome/browser/chromeos/power/session_state_controller_delegate_chrome
os.h" |
| 15 #include "chrome/common/chrome_notification_types.h" | 15 #include "chrome/common/chrome_notification_types.h" |
| 16 #include "chromeos/dbus/dbus_thread_manager.h" | 16 #include "chromeos/dbus/dbus_thread_manager.h" |
| 17 #include "content/public/browser/notification_service.h" | 17 #include "content/public/browser/notification_service.h" |
| 18 | 18 |
| 19 namespace chromeos { | 19 namespace chromeos { |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 ash::user::LoginStatus GetCurrentLoginStatus() { | 23 ash::user::LoginStatus GetCurrentLoginStatus() { |
| 24 const UserManager* user_manager = UserManager::Get(); | 24 const UserManager* user_manager = UserManager::Get(); |
| 25 if (!user_manager->IsUserLoggedIn()) | 25 if (!user_manager->IsUserLoggedIn()) |
| 26 return ash::user::LOGGED_IN_NONE; | 26 return ash::user::LOGGED_IN_NONE; |
| 27 | 27 |
| 28 if (user_manager->GetLoggedInUser()->is_guest()) | 28 if (user_manager->GetLoggedInUser()->is_guest()) |
| 29 return ash::user::LOGGED_IN_GUEST; | 29 return ash::user::LOGGED_IN_GUEST; |
| 30 | 30 |
| 31 return ash::user::LOGGED_IN_USER; | 31 return ash::user::LOGGED_IN_USER; |
| 32 } | 32 } |
| 33 | 33 |
| 34 } // namespace | 34 } // namespace |
| 35 | 35 |
| 36 PowerButtonObserver::PowerButtonObserver() { | 36 PowerButtonObserver::PowerButtonObserver() { |
| 37 ash::Shell::GetInstance()->power_button_controller()-> | 37 ash::Shell::GetInstance()->session_state_controller()-> |
| 38 set_delegate(new PowerButtonControllerDelegateChromeos); | 38 SetDelegate(new SessionStateControllerDelegateChromeos); |
| 39 | 39 |
| 40 registrar_.Add( | 40 registrar_.Add( |
| 41 this, | 41 this, |
| 42 chrome::NOTIFICATION_LOGIN_USER_CHANGED, | 42 chrome::NOTIFICATION_LOGIN_USER_CHANGED, |
| 43 content::NotificationService::AllSources()); | 43 content::NotificationService::AllSources()); |
| 44 registrar_.Add( | 44 registrar_.Add( |
| 45 this, | 45 this, |
| 46 chrome::NOTIFICATION_APP_TERMINATING, | 46 chrome::NOTIFICATION_APP_TERMINATING, |
| 47 content::NotificationService::AllSources()); | 47 content::NotificationService::AllSources()); |
| 48 registrar_.Add( | 48 registrar_.Add( |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 OnPowerButtonEvent(down, timestamp); | 93 OnPowerButtonEvent(down, timestamp); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void PowerButtonObserver::LockButtonStateChanged( | 96 void PowerButtonObserver::LockButtonStateChanged( |
| 97 bool down, const base::TimeTicks& timestamp) { | 97 bool down, const base::TimeTicks& timestamp) { |
| 98 ash::Shell::GetInstance()->power_button_controller()-> | 98 ash::Shell::GetInstance()->power_button_controller()-> |
| 99 OnLockButtonEvent(down, timestamp); | 99 OnLockButtonEvent(down, timestamp); |
| 100 } | 100 } |
| 101 | 101 |
| 102 void PowerButtonObserver::LockScreen() { | 102 void PowerButtonObserver::LockScreen() { |
| 103 ash::Shell::GetInstance()->power_button_controller()->OnStartingLock(); | 103 ash::Shell::GetInstance()->session_state_controller()->OnStartingLock(); |
| 104 } | 104 } |
| 105 | 105 |
| 106 } // namespace chromeos | 106 } // namespace chromeos |
| OLD | NEW |