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