| 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/login/screen_locker.h" | 5 #include "chrome/browser/chromeos/login/screen_locker.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "chrome/browser/chromeos/login/login_utils.h" | 21 #include "chrome/browser/chromeos/login/login_utils.h" |
| 22 #include "chrome/browser/chromeos/login/user_manager.h" | 22 #include "chrome/browser/chromeos/login/user_manager.h" |
| 23 #include "chrome/browser/chromeos/login/webui_screen_locker.h" | 23 #include "chrome/browser/chromeos/login/webui_screen_locker.h" |
| 24 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
| 25 #include "chrome/browser/profiles/profile_manager.h" | 25 #include "chrome/browser/profiles/profile_manager.h" |
| 26 #include "chrome/browser/signin/signin_manager.h" | 26 #include "chrome/browser/signin/signin_manager.h" |
| 27 #include "chrome/browser/signin/signin_manager_factory.h" | 27 #include "chrome/browser/signin/signin_manager_factory.h" |
| 28 #include "chrome/browser/sync/profile_sync_service.h" | 28 #include "chrome/browser/sync/profile_sync_service.h" |
| 29 #include "chrome/browser/sync/profile_sync_service_factory.h" | 29 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 30 #include "chrome/browser/ui/browser.h" | 30 #include "chrome/browser/ui/browser.h" |
| 31 #include "chrome/browser/ui/browser_commands.h" |
| 31 #include "chrome/browser/ui/browser_list.h" | 32 #include "chrome/browser/ui/browser_list.h" |
| 32 #include "chrome/browser/ui/browser_window.h" | 33 #include "chrome/browser/ui/browser_window.h" |
| 33 #include "chrome/common/chrome_notification_types.h" | 34 #include "chrome/common/chrome_notification_types.h" |
| 34 #include "chrome/common/chrome_switches.h" | 35 #include "chrome/common/chrome_switches.h" |
| 35 #include "chromeos/dbus/dbus_thread_manager.h" | 36 #include "chromeos/dbus/dbus_thread_manager.h" |
| 36 #include "chromeos/dbus/power_manager_client.h" | 37 #include "chromeos/dbus/power_manager_client.h" |
| 37 #include "chromeos/dbus/session_manager_client.h" | 38 #include "chromeos/dbus/session_manager_client.h" |
| 38 #include "content/public/browser/browser_thread.h" | 39 #include "content/public/browser/browser_thread.h" |
| 39 #include "content/public/browser/notification_service.h" | 40 #include "content/public/browser/notification_service.h" |
| 40 #include "content/public/browser/user_metrics.h" | 41 #include "content/public/browser/user_metrics.h" |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 UserManager::Get()->IsLoggedInAsDemoUser()) { | 275 UserManager::Get()->IsLoggedInAsDemoUser()) { |
| 275 DVLOG(1) << "Show: Refusing to lock screen for guest/demo account."; | 276 DVLOG(1) << "Show: Refusing to lock screen for guest/demo account."; |
| 276 return; | 277 return; |
| 277 } | 278 } |
| 278 | 279 |
| 279 // Exit fullscreen. | 280 // Exit fullscreen. |
| 280 Browser* browser = BrowserList::GetLastActive(); | 281 Browser* browser = BrowserList::GetLastActive(); |
| 281 // browser can be NULL if we receive a lock request before the first browser | 282 // browser can be NULL if we receive a lock request before the first browser |
| 282 // window is shown. | 283 // window is shown. |
| 283 if (browser && browser->window()->IsFullscreen()) { | 284 if (browser && browser->window()->IsFullscreen()) { |
| 284 browser->ToggleFullscreenMode(); | 285 chrome::ToggleFullscreenMode(browser); |
| 285 } | 286 } |
| 286 | 287 |
| 287 if (!screen_locker_) { | 288 if (!screen_locker_) { |
| 288 DVLOG(1) << "Show: Locking screen"; | 289 DVLOG(1) << "Show: Locking screen"; |
| 289 ScreenLocker* locker = | 290 ScreenLocker* locker = |
| 290 new ScreenLocker(UserManager::Get()->GetLoggedInUser()); | 291 new ScreenLocker(UserManager::Get()->GetLoggedInUser()); |
| 291 locker->Init(); | 292 locker->Init(); |
| 292 } else { | 293 } else { |
| 293 // PowerManager re-sends lock screen signal if it doesn't | 294 // PowerManager re-sends lock screen signal if it doesn't |
| 294 // receive the response within timeout. Just send complete | 295 // receive the response within timeout. Just send complete |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 bool state = true; | 369 bool state = true; |
| 369 content::NotificationService::current()->Notify( | 370 content::NotificationService::current()->Notify( |
| 370 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, | 371 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, |
| 371 content::Source<ScreenLocker>(this), | 372 content::Source<ScreenLocker>(this), |
| 372 content::Details<bool>(&state)); | 373 content::Details<bool>(&state)); |
| 373 DBusThreadManager::Get()->GetPowerManagerClient()-> | 374 DBusThreadManager::Get()->GetPowerManagerClient()-> |
| 374 NotifyScreenLockCompleted(); | 375 NotifyScreenLockCompleted(); |
| 375 } | 376 } |
| 376 | 377 |
| 377 } // namespace chromeos | 378 } // namespace chromeos |
| OLD | NEW |