Chromium Code Reviews| 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 "ash/desktop_background/desktop_background_controller.h" | 10 #include "ash/desktop_background/desktop_background_controller.h" |
| 11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 12 #include "ash/wm/session_state_controller.h" | |
| 12 #include "base/bind.h" | 13 #include "base/bind.h" |
| 13 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 14 #include "base/lazy_instance.h" | 15 #include "base/lazy_instance.h" |
| 15 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 16 #include "base/message_loop.h" | 17 #include "base/message_loop.h" |
| 17 #include "base/metrics/histogram.h" | 18 #include "base/metrics/histogram.h" |
| 18 #include "base/string_util.h" | 19 #include "base/string_util.h" |
| 19 #include "base/timer.h" | 20 #include "base/timer.h" |
| 20 #include "base/utf_string_conversions.h" | 21 #include "base/utf_string_conversions.h" |
| 21 #include "chrome/browser/chromeos/login/authenticator.h" | 22 #include "chrome/browser/chromeos/login/authenticator.h" |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 299 void ScreenLocker::Hide() { | 300 void ScreenLocker::Hide() { |
| 300 DCHECK(MessageLoop::current()->type() == MessageLoop::TYPE_UI); | 301 DCHECK(MessageLoop::current()->type() == MessageLoop::TYPE_UI); |
| 301 // For a guest/demo user, screen_locker_ would have never been initialized. | 302 // For a guest/demo user, screen_locker_ would have never been initialized. |
| 302 if (UserManager::Get()->IsLoggedInAsGuest() || | 303 if (UserManager::Get()->IsLoggedInAsGuest() || |
| 303 UserManager::Get()->IsLoggedInAsDemoUser()) { | 304 UserManager::Get()->IsLoggedInAsDemoUser()) { |
| 304 VLOG(1) << "Refusing to hide lock screen for guest/demo account"; | 305 VLOG(1) << "Refusing to hide lock screen for guest/demo account"; |
| 305 return; | 306 return; |
| 306 } | 307 } |
| 307 | 308 |
| 308 DCHECK(screen_locker_); | 309 DCHECK(screen_locker_); |
| 310 base::Callback<void(void)> callback = | |
| 311 base::Bind(&ScreenLocker::ScheduleDeletion); | |
| 312 ash::Shell::GetInstance()->session_state_controller()-> | |
| 313 OnLockScreenHide(callback); | |
| 314 } | |
| 315 | |
| 316 void ScreenLocker::ScheduleDeletion() { | |
|
Nikita (slow)
2012/10/26 10:37:46
nit: // static
| |
| 317 // Avoid possible multiple calls. | |
| 318 if (screen_locker_ == NULL) | |
| 319 return; | |
| 309 VLOG(1) << "Posting task to delete ScreenLocker " << screen_locker_; | 320 VLOG(1) << "Posting task to delete ScreenLocker " << screen_locker_; |
| 310 MessageLoopForUI::current()->DeleteSoon(FROM_HERE, screen_locker_); | 321 ScreenLocker* screen_locker = screen_locker_; |
| 322 screen_locker_ = NULL; | |
| 323 MessageLoopForUI::current()->DeleteSoon(FROM_HERE, screen_locker); | |
| 311 } | 324 } |
| 312 | 325 |
| 313 // static | 326 // static |
| 314 void ScreenLocker::InitClass() { | 327 void ScreenLocker::InitClass() { |
| 315 g_screen_lock_observer.Get(); | 328 g_screen_lock_observer.Get(); |
| 316 } | 329 } |
| 317 | 330 |
| 318 //////////////////////////////////////////////////////////////////////////////// | 331 //////////////////////////////////////////////////////////////////////////////// |
| 319 // ScreenLocker, private: | 332 // ScreenLocker, private: |
| 320 | 333 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 358 VLOG(1) << "Emitting SCREEN_LOCK_STATE_CHANGED with state=" << state; | 371 VLOG(1) << "Emitting SCREEN_LOCK_STATE_CHANGED with state=" << state; |
| 359 content::NotificationService::current()->Notify( | 372 content::NotificationService::current()->Notify( |
| 360 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, | 373 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, |
| 361 content::Source<ScreenLocker>(this), | 374 content::Source<ScreenLocker>(this), |
| 362 content::Details<bool>(&state)); | 375 content::Details<bool>(&state)); |
| 363 VLOG(1) << "Calling session manager's HandleLockScreenShown D-Bus method"; | 376 VLOG(1) << "Calling session manager's HandleLockScreenShown D-Bus method"; |
| 364 DBusThreadManager::Get()->GetSessionManagerClient()->NotifyLockScreenShown(); | 377 DBusThreadManager::Get()->GetSessionManagerClient()->NotifyLockScreenShown(); |
| 365 } | 378 } |
| 366 | 379 |
| 367 } // namespace chromeos | 380 } // namespace chromeos |
| OLD | NEW |