| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/suspend_observer.h" | 5 #include "chrome/browser/chromeos/power/suspend_observer.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/wm/user_activity_detector.h" | 8 #include "ash/wm/user_activity_detector.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "chrome/browser/chromeos/login/user_manager.h" | 10 #include "chrome/browser/chromeos/login/user_manager.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 } | 49 } |
| 50 | 50 |
| 51 void SuspendObserver::ScreenIsLocked() { | 51 void SuspendObserver::ScreenIsLocked() { |
| 52 screen_locked_ = true; | 52 screen_locked_ = true; |
| 53 | 53 |
| 54 // Stop blocking suspend after the screen is locked. | 54 // Stop blocking suspend after the screen is locked. |
| 55 if (!screen_lock_callback_.is_null()) { | 55 if (!screen_lock_callback_.is_null()) { |
| 56 // Run the callback asynchronously. ScreenIsLocked() is currently | 56 // Run the callback asynchronously. ScreenIsLocked() is currently |
| 57 // called asynchronously after RequestLockScreen(), but this guards | 57 // called asynchronously after RequestLockScreen(), but this guards |
| 58 // against it being made synchronous later. | 58 // against it being made synchronous later. |
| 59 MessageLoop::current()->PostTask(FROM_HERE, screen_lock_callback_); | 59 base::MessageLoop::current()->PostTask(FROM_HERE, screen_lock_callback_); |
| 60 screen_lock_callback_.Reset(); | 60 screen_lock_callback_.Reset(); |
| 61 } | 61 } |
| 62 } | 62 } |
| 63 | 63 |
| 64 void SuspendObserver::ScreenIsUnlocked() { | 64 void SuspendObserver::ScreenIsUnlocked() { |
| 65 screen_locked_ = false; | 65 screen_locked_ = false; |
| 66 } | 66 } |
| 67 | 67 |
| 68 } // namespace chromeos | 68 } // namespace chromeos |
| OLD | NEW |