Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/lock/webui_screen_locker.h" | 5 #include "chrome/browser/chromeos/login/lock/webui_screen_locker.h" |
| 6 | 6 |
| 7 #include "ash/wm/lock_state_controller.h" | 7 #include "ash/wm/lock_state_controller.h" |
| 8 #include "ash/wm/lock_state_observer.h" | 8 #include "ash/wm/lock_state_observer.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 147 return GetWebUI(); | 147 return GetWebUI(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 void WebUIScreenLocker::FocusUserPod() { | 150 void WebUIScreenLocker::FocusUserPod() { |
| 151 if (!webui_ready_) | 151 if (!webui_ready_) |
| 152 return; | 152 return; |
| 153 webui_login_->RequestFocus(); | 153 webui_login_->RequestFocus(); |
| 154 GetWebUI()->CallJavascriptFunction("cr.ui.Oobe.forceLockedUserPodFocus"); | 154 GetWebUI()->CallJavascriptFunction("cr.ui.Oobe.forceLockedUserPodFocus"); |
| 155 } | 155 } |
| 156 | 156 |
| 157 void WebUIScreenLocker::ResetAndFocusUserPod() { | |
| 158 if (!webui_ready_) | |
| 159 return; | |
| 160 GetWebUI()->CallJavascriptFunction("cr.ui.Oobe.clearUserPodPassword"); | |
| 161 FocusUserPod(); | |
| 162 } | |
| 163 | |
| 157 WebUIScreenLocker::~WebUIScreenLocker() { | 164 WebUIScreenLocker::~WebUIScreenLocker() { |
| 158 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); | 165 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); |
| 159 ash::Shell::GetScreen()->RemoveObserver(this); | 166 ash::Shell::GetScreen()->RemoveObserver(this); |
| 160 ash::Shell::GetInstance()-> | 167 ash::Shell::GetInstance()-> |
| 161 lock_state_controller()->RemoveObserver(this); | 168 lock_state_controller()->RemoveObserver(this); |
| 162 | 169 |
| 163 ash::Shell::GetInstance()->delegate()-> | 170 ash::Shell::GetInstance()->delegate()-> |
| 164 RemoveVirtualKeyboardStateObserver(this); | 171 RemoveVirtualKeyboardStateObserver(this); |
| 165 // In case of shutdown, lock_window_ may be deleted before WebUIScreenLocker. | 172 // In case of shutdown, lock_window_ may be deleted before WebUIScreenLocker. |
| 166 if (lock_window_) { | 173 if (lock_window_) { |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 301 void WebUIScreenLocker::OnWidgetDestroying(views::Widget* widget) { | 308 void WebUIScreenLocker::OnWidgetDestroying(views::Widget* widget) { |
| 302 lock_window_->RemoveObserver(this); | 309 lock_window_->RemoveObserver(this); |
| 303 lock_window_ = NULL; | 310 lock_window_ = NULL; |
| 304 } | 311 } |
| 305 | 312 |
| 306 //////////////////////////////////////////////////////////////////////////////// | 313 //////////////////////////////////////////////////////////////////////////////// |
| 307 // PowerManagerClient::Observer: | 314 // PowerManagerClient::Observer: |
| 308 | 315 |
| 309 void WebUIScreenLocker::LidEventReceived(bool open, | 316 void WebUIScreenLocker::LidEventReceived(bool open, |
| 310 const base::TimeTicks& time) { | 317 const base::TimeTicks& time) { |
| 318 if (open) { | |
| 319 content::BrowserThread::PostTask( | |
| 320 content::BrowserThread::UI, FROM_HERE, | |
| 321 base::Bind(&WebUIScreenLocker::FocusUserPod, | |
| 322 weak_factory_.GetWeakPtr())); | |
| 323 } | |
| 324 } | |
| 325 | |
| 326 void WebUIScreenLocker::SuspendImminent() { | |
| 311 content::BrowserThread::PostTask( | 327 content::BrowserThread::PostTask( |
|
Chirantan Ekbote
2015/02/11 22:53:12
This can race with the system suspend if the messa
| |
| 312 content::BrowserThread::UI, | 328 content::BrowserThread::UI, FROM_HERE, |
| 313 FROM_HERE, | 329 base::Bind(&WebUIScreenLocker::ResetAndFocusUserPod, |
| 314 base::Bind(&WebUIScreenLocker::FocusUserPod, weak_factory_.GetWeakPtr())); | 330 weak_factory_.GetWeakPtr())); |
| 315 } | 331 } |
| 316 | 332 |
| 317 void WebUIScreenLocker::SuspendDone(const base::TimeDelta& sleep_duration) { | 333 void WebUIScreenLocker::SuspendDone(const base::TimeDelta& sleep_duration) { |
| 318 content::BrowserThread::PostTask( | 334 content::BrowserThread::PostTask( |
| 319 content::BrowserThread::UI, | 335 content::BrowserThread::UI, |
| 320 FROM_HERE, | 336 FROM_HERE, |
| 321 base::Bind(&WebUIScreenLocker::FocusUserPod, weak_factory_.GetWeakPtr())); | 337 base::Bind(&WebUIScreenLocker::FocusUserPod, weak_factory_.GetWeakPtr())); |
| 322 } | 338 } |
| 323 | 339 |
| 324 void WebUIScreenLocker::RenderProcessGone(base::TerminationStatus status) { | 340 void WebUIScreenLocker::RenderProcessGone(base::TerminationStatus status) { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 389 } | 405 } |
| 390 | 406 |
| 391 if (GetOobeUI()) { | 407 if (GetOobeUI()) { |
| 392 const gfx::Size& size = primary_display.size(); | 408 const gfx::Size& size = primary_display.size(); |
| 393 GetOobeUI()->GetCoreOobeActor()->SetClientAreaSize(size.width(), | 409 GetOobeUI()->GetCoreOobeActor()->SetClientAreaSize(size.width(), |
| 394 size.height()); | 410 size.height()); |
| 395 } | 411 } |
| 396 } | 412 } |
| 397 | 413 |
| 398 } // namespace chromeos | 414 } // namespace chromeos |
| OLD | NEW |