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 "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // the signin steps. See crbug.com/112225 and crbug.com/110933. | 96 // the signin steps. See crbug.com/112225 and crbug.com/110933. |
97 chromeos::DBusThreadManager::Get()-> | 97 chromeos::DBusThreadManager::Get()-> |
98 GetSessionManagerClient()->StopSession(); | 98 GetSessionManagerClient()->StopSession(); |
99 } | 99 } |
100 } | 100 } |
101 | 101 |
102 virtual void UnlockScreen() OVERRIDE { | 102 virtual void UnlockScreen() OVERRIDE { |
103 chromeos::ScreenLocker::Hide(); | 103 chromeos::ScreenLocker::Hide(); |
104 } | 104 } |
105 | 105 |
106 virtual void UnlockScreenFailed() OVERRIDE { | |
107 chromeos::ScreenLocker::UnlockScreenFailed(); | |
108 } | |
109 | |
110 private: | 106 private: |
111 bool session_started_; | 107 bool session_started_; |
112 content::NotificationRegistrar registrar_; | 108 content::NotificationRegistrar registrar_; |
113 std::string saved_previous_input_method_id_; | 109 std::string saved_previous_input_method_id_; |
114 std::string saved_current_input_method_id_; | 110 std::string saved_current_input_method_id_; |
115 std::vector<std::string> saved_active_input_method_list_; | 111 std::vector<std::string> saved_active_input_method_list_; |
116 | 112 |
117 DISALLOW_COPY_AND_ASSIGN(ScreenLockObserver); | 113 DISALLOW_COPY_AND_ASSIGN(ScreenLockObserver); |
118 }; | 114 }; |
119 | 115 |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 DVLOG(1) << "Hide: Nothing to do for guest/demo account."; | 304 DVLOG(1) << "Hide: Nothing to do for guest/demo account."; |
309 return; | 305 return; |
310 } | 306 } |
311 | 307 |
312 DCHECK(screen_locker_); | 308 DCHECK(screen_locker_); |
313 VLOG(1) << "Hide: Deleting ScreenLocker: " << screen_locker_; | 309 VLOG(1) << "Hide: Deleting ScreenLocker: " << screen_locker_; |
314 MessageLoopForUI::current()->DeleteSoon(FROM_HERE, screen_locker_); | 310 MessageLoopForUI::current()->DeleteSoon(FROM_HERE, screen_locker_); |
315 } | 311 } |
316 | 312 |
317 // static | 313 // static |
318 void ScreenLocker::UnlockScreenFailed() { | |
319 DCHECK(MessageLoop::current()->type() == MessageLoop::TYPE_UI); | |
320 if (screen_locker_) { | |
321 // Power manager decided no to unlock the screen even if a user | |
322 // typed in password, for example, when a user closed the lid | |
323 // immediately after typing in the password. | |
324 VLOG(1) << "UnlockScreenFailed: re-enabling screen locker."; | |
325 screen_locker_->EnableInput(); | |
326 } else { | |
327 // This can happen when a user requested unlock, but PowerManager | |
328 // rejected because the computer is closed, then PowerManager unlocked | |
329 // because it's open again and the above failure message arrives. | |
330 // This'd be extremely rare, but may still happen. | |
331 VLOG(1) << "UnlockScreenFailed: screen is already unlocked."; | |
332 } | |
333 } | |
334 | |
335 // static | |
336 void ScreenLocker::InitClass() { | 314 void ScreenLocker::InitClass() { |
337 g_screen_lock_observer.Get(); | 315 g_screen_lock_observer.Get(); |
338 } | 316 } |
339 | 317 |
340 //////////////////////////////////////////////////////////////////////////////// | 318 //////////////////////////////////////////////////////////////////////////////// |
341 // ScreenLocker, private: | 319 // ScreenLocker, private: |
342 | 320 |
343 ScreenLocker::~ScreenLocker() { | 321 ScreenLocker::~ScreenLocker() { |
344 DCHECK(MessageLoop::current()->type() == MessageLoop::TYPE_UI); | 322 DCHECK(MessageLoop::current()->type() == MessageLoop::TYPE_UI); |
345 ClearErrors(); | 323 ClearErrors(); |
(...skipping 22 matching lines...) Expand all Loading... |
368 bool state = true; | 346 bool state = true; |
369 content::NotificationService::current()->Notify( | 347 content::NotificationService::current()->Notify( |
370 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, | 348 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, |
371 content::Source<ScreenLocker>(this), | 349 content::Source<ScreenLocker>(this), |
372 content::Details<bool>(&state)); | 350 content::Details<bool>(&state)); |
373 DBusThreadManager::Get()->GetPowerManagerClient()-> | 351 DBusThreadManager::Get()->GetPowerManagerClient()-> |
374 NotifyScreenLockCompleted(); | 352 NotifyScreenLockCompleted(); |
375 } | 353 } |
376 | 354 |
377 } // namespace chromeos | 355 } // namespace chromeos |
OLD | NEW |