| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "ash/system/chromeos/power/power_event_observer.h" | 5 #include "ash/system/chromeos/power/power_event_observer.h" |
| 6 | 6 |
| 7 #include "ash/common/session/session_controller.h" | 7 #include "ash/common/session/session_controller.h" |
| 8 #include "ash/common/system/tray/system_tray_notifier.h" | 8 #include "ash/common/system/tray/system_tray_notifier.h" |
| 9 #include "ash/common/wm_shell.h" | 9 #include "ash/common/wm_shell.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 ->GetPowerManagerClient() | 127 ->GetPowerManagerClient() |
| 128 ->GetSuspendReadinessCallback())); | 128 ->GetSuspendReadinessCallback())); |
| 129 } | 129 } |
| 130 } | 130 } |
| 131 | 131 |
| 132 void PowerEventObserver::SuspendDone(const base::TimeDelta& sleep_duration) { | 132 void PowerEventObserver::SuspendDone(const base::TimeDelta& sleep_duration) { |
| 133 // TODO(derat): After mus exposes a method for resuming displays, call it | 133 // TODO(derat): After mus exposes a method for resuming displays, call it |
| 134 // here: http://crbug.com/692193 | 134 // here: http://crbug.com/692193 |
| 135 if (!WmShell::Get()->IsRunningInMash()) | 135 if (!WmShell::Get()->IsRunningInMash()) |
| 136 Shell::GetInstance()->display_configurator()->ResumeDisplays(); | 136 Shell::GetInstance()->display_configurator()->ResumeDisplays(); |
| 137 WmShell::Get()->system_tray_notifier()->NotifyRefreshClock(); | 137 Shell::Get()->system_tray_notifier()->NotifyRefreshClock(); |
| 138 | 138 |
| 139 // If the suspend request was being blocked while waiting for the lock | 139 // If the suspend request was being blocked while waiting for the lock |
| 140 // animation to complete, clear the blocker since the suspend has already | 140 // animation to complete, clear the blocker since the suspend has already |
| 141 // completed. This prevents rendering requests from being blocked after a | 141 // completed. This prevents rendering requests from being blocked after a |
| 142 // resume if the lock screen took too long to show. | 142 // resume if the lock screen took too long to show. |
| 143 screen_lock_callback_.Reset(); | 143 screen_lock_callback_.Reset(); |
| 144 | 144 |
| 145 ResumeRenderingRequests(); | 145 ResumeRenderingRequests(); |
| 146 } | 146 } |
| 147 | 147 |
| 148 void PowerEventObserver::ScreenIsLocked() { | 148 void PowerEventObserver::ScreenIsLocked() { |
| 149 screen_locked_ = true; | 149 screen_locked_ = true; |
| 150 waiting_for_lock_screen_animations_ = true; | 150 waiting_for_lock_screen_animations_ = true; |
| 151 | 151 |
| 152 // The screen is now locked but the pending suspend, if any, will be blocked | 152 // The screen is now locked but the pending suspend, if any, will be blocked |
| 153 // until all the animations have completed. | 153 // until all the animations have completed. |
| 154 if (!screen_lock_callback_.is_null()) { | 154 if (!screen_lock_callback_.is_null()) { |
| 155 VLOG(1) << "Screen locked due to suspend"; | 155 VLOG(1) << "Screen locked due to suspend"; |
| 156 } else { | 156 } else { |
| 157 VLOG(1) << "Screen locked without suspend"; | 157 VLOG(1) << "Screen locked without suspend"; |
| 158 } | 158 } |
| 159 } | 159 } |
| 160 | 160 |
| 161 void PowerEventObserver::ScreenIsUnlocked() { | 161 void PowerEventObserver::ScreenIsUnlocked() { |
| 162 screen_locked_ = false; | 162 screen_locked_ = false; |
| 163 } | 163 } |
| 164 | 164 |
| 165 } // namespace ash | 165 } // namespace ash |
| OLD | NEW |