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 webui_login_->RequestFocus(); | |
Nikita (slow)
2015/02/10 13:00:10
FocusUserPod()
Dmitry Polukhin
2015/02/10 13:05:33
Done.
| |
162 GetWebUI()->CallJavascriptFunction("cr.ui.Oobe.forceLockedUserPodFocus"); | |
163 } | |
164 | |
157 WebUIScreenLocker::~WebUIScreenLocker() { | 165 WebUIScreenLocker::~WebUIScreenLocker() { |
158 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); | 166 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); |
159 ash::Shell::GetScreen()->RemoveObserver(this); | 167 ash::Shell::GetScreen()->RemoveObserver(this); |
160 ash::Shell::GetInstance()-> | 168 ash::Shell::GetInstance()-> |
161 lock_state_controller()->RemoveObserver(this); | 169 lock_state_controller()->RemoveObserver(this); |
162 | 170 |
163 ash::Shell::GetInstance()->delegate()-> | 171 ash::Shell::GetInstance()->delegate()-> |
164 RemoveVirtualKeyboardStateObserver(this); | 172 RemoveVirtualKeyboardStateObserver(this); |
165 // In case of shutdown, lock_window_ may be deleted before WebUIScreenLocker. | 173 // In case of shutdown, lock_window_ may be deleted before WebUIScreenLocker. |
166 if (lock_window_) { | 174 if (lock_window_) { |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
301 void WebUIScreenLocker::OnWidgetDestroying(views::Widget* widget) { | 309 void WebUIScreenLocker::OnWidgetDestroying(views::Widget* widget) { |
302 lock_window_->RemoveObserver(this); | 310 lock_window_->RemoveObserver(this); |
303 lock_window_ = NULL; | 311 lock_window_ = NULL; |
304 } | 312 } |
305 | 313 |
306 //////////////////////////////////////////////////////////////////////////////// | 314 //////////////////////////////////////////////////////////////////////////////// |
307 // PowerManagerClient::Observer: | 315 // PowerManagerClient::Observer: |
308 | 316 |
309 void WebUIScreenLocker::LidEventReceived(bool open, | 317 void WebUIScreenLocker::LidEventReceived(bool open, |
310 const base::TimeTicks& time) { | 318 const base::TimeTicks& time) { |
319 if (open) { | |
320 content::BrowserThread::PostTask( | |
321 content::BrowserThread::UI, FROM_HERE, | |
322 base::Bind(&WebUIScreenLocker::FocusUserPod, | |
323 weak_factory_.GetWeakPtr())); | |
324 } | |
325 } | |
326 | |
327 void WebUIScreenLocker::SuspendImminent() { | |
311 content::BrowserThread::PostTask( | 328 content::BrowserThread::PostTask( |
312 content::BrowserThread::UI, | 329 content::BrowserThread::UI, FROM_HERE, |
313 FROM_HERE, | 330 base::Bind(&WebUIScreenLocker::ResetAndFocusUserPod, |
314 base::Bind(&WebUIScreenLocker::FocusUserPod, weak_factory_.GetWeakPtr())); | 331 weak_factory_.GetWeakPtr())); |
315 } | 332 } |
316 | 333 |
317 void WebUIScreenLocker::SuspendDone(const base::TimeDelta& sleep_duration) { | 334 void WebUIScreenLocker::SuspendDone(const base::TimeDelta& sleep_duration) { |
318 content::BrowserThread::PostTask( | 335 content::BrowserThread::PostTask( |
319 content::BrowserThread::UI, | 336 content::BrowserThread::UI, |
320 FROM_HERE, | 337 FROM_HERE, |
321 base::Bind(&WebUIScreenLocker::FocusUserPod, weak_factory_.GetWeakPtr())); | 338 base::Bind(&WebUIScreenLocker::FocusUserPod, weak_factory_.GetWeakPtr())); |
322 } | 339 } |
323 | 340 |
324 void WebUIScreenLocker::RenderProcessGone(base::TerminationStatus status) { | 341 void WebUIScreenLocker::RenderProcessGone(base::TerminationStatus status) { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
389 } | 406 } |
390 | 407 |
391 if (GetOobeUI()) { | 408 if (GetOobeUI()) { |
392 const gfx::Size& size = primary_display.size(); | 409 const gfx::Size& size = primary_display.size(); |
393 GetOobeUI()->GetCoreOobeActor()->SetClientAreaSize(size.width(), | 410 GetOobeUI()->GetCoreOobeActor()->SetClientAreaSize(size.width(), |
394 size.height()); | 411 size.height()); |
395 } | 412 } |
396 } | 413 } |
397 | 414 |
398 } // namespace chromeos | 415 } // namespace chromeos |
OLD | NEW |