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 "ash/desktop_background/desktop_background_controller.h" |
| 11 #include "ash/shell.h" |
10 #include "base/bind.h" | 12 #include "base/bind.h" |
11 #include "base/command_line.h" | 13 #include "base/command_line.h" |
12 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
13 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
14 #include "base/message_loop.h" | 16 #include "base/message_loop.h" |
15 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
16 #include "base/string_util.h" | 18 #include "base/string_util.h" |
17 #include "base/timer.h" | 19 #include "base/timer.h" |
18 #include "base/utf_string_conversions.h" | 20 #include "base/utf_string_conversions.h" |
19 #include "chrome/browser/chromeos/login/authenticator.h" | 21 #include "chrome/browser/chromeos/login/authenticator.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 start_time_(base::Time::Now()), | 138 start_time_(base::Time::Now()), |
137 login_status_consumer_(NULL), | 139 login_status_consumer_(NULL), |
138 incorrect_passwords_count_(0) { | 140 incorrect_passwords_count_(0) { |
139 DCHECK(!screen_locker_); | 141 DCHECK(!screen_locker_); |
140 screen_locker_ = this; | 142 screen_locker_ = this; |
141 } | 143 } |
142 | 144 |
143 void ScreenLocker::Init() { | 145 void ScreenLocker::Init() { |
144 authenticator_ = LoginUtils::Get()->CreateAuthenticator(this); | 146 authenticator_ = LoginUtils::Get()->CreateAuthenticator(this); |
145 delegate_.reset(new WebUIScreenLocker(this)); | 147 delegate_.reset(new WebUIScreenLocker(this)); |
| 148 ash::Shell::GetInstance()-> |
| 149 desktop_background_controller()->MoveDesktopToLockedContainer(); |
146 delegate_->LockScreen(unlock_on_input_); | 150 delegate_->LockScreen(unlock_on_input_); |
147 } | 151 } |
148 | 152 |
149 void ScreenLocker::OnLoginFailure(const LoginFailure& error) { | 153 void ScreenLocker::OnLoginFailure(const LoginFailure& error) { |
150 DVLOG(1) << "OnLoginFailure"; | 154 DVLOG(1) << "OnLoginFailure"; |
151 content::RecordAction(UserMetricsAction("ScreenLocker_OnLoginFailure")); | 155 content::RecordAction(UserMetricsAction("ScreenLocker_OnLoginFailure")); |
152 if (authentication_start_time_.is_null()) { | 156 if (authentication_start_time_.is_null()) { |
153 LOG(ERROR) << "authentication_start_time_ is not set"; | 157 LOG(ERROR) << "authentication_start_time_ is not set"; |
154 } else { | 158 } else { |
155 base::TimeDelta delta = base::Time::Now() - authentication_start_time_; | 159 base::TimeDelta delta = base::Time::Now() - authentication_start_time_; |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 void ScreenLocker::InitClass() { | 315 void ScreenLocker::InitClass() { |
312 g_screen_lock_observer.Get(); | 316 g_screen_lock_observer.Get(); |
313 } | 317 } |
314 | 318 |
315 //////////////////////////////////////////////////////////////////////////////// | 319 //////////////////////////////////////////////////////////////////////////////// |
316 // ScreenLocker, private: | 320 // ScreenLocker, private: |
317 | 321 |
318 ScreenLocker::~ScreenLocker() { | 322 ScreenLocker::~ScreenLocker() { |
319 DCHECK(MessageLoop::current()->type() == MessageLoop::TYPE_UI); | 323 DCHECK(MessageLoop::current()->type() == MessageLoop::TYPE_UI); |
320 ClearErrors(); | 324 ClearErrors(); |
| 325 ash::Shell::GetInstance()-> |
| 326 desktop_background_controller()->MoveDesktopToUnlockedContainer(); |
321 | 327 |
322 screen_locker_ = NULL; | 328 screen_locker_ = NULL; |
323 bool state = false; | 329 bool state = false; |
324 content::NotificationService::current()->Notify( | 330 content::NotificationService::current()->Notify( |
325 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, | 331 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, |
326 content::Source<ScreenLocker>(this), | 332 content::Source<ScreenLocker>(this), |
327 content::Details<bool>(&state)); | 333 content::Details<bool>(&state)); |
328 DBusThreadManager::Get()->GetPowerManagerClient()-> | 334 DBusThreadManager::Get()->GetPowerManagerClient()-> |
329 NotifyScreenUnlockCompleted(); | 335 NotifyScreenUnlockCompleted(); |
330 } | 336 } |
(...skipping 12 matching lines...) Expand all Loading... |
343 bool state = true; | 349 bool state = true; |
344 content::NotificationService::current()->Notify( | 350 content::NotificationService::current()->Notify( |
345 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, | 351 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, |
346 content::Source<ScreenLocker>(this), | 352 content::Source<ScreenLocker>(this), |
347 content::Details<bool>(&state)); | 353 content::Details<bool>(&state)); |
348 DBusThreadManager::Get()->GetPowerManagerClient()-> | 354 DBusThreadManager::Get()->GetPowerManagerClient()-> |
349 NotifyScreenLockCompleted(); | 355 NotifyScreenLockCompleted(); |
350 } | 356 } |
351 | 357 |
352 } // namespace chromeos | 358 } // namespace chromeos |
OLD | NEW |