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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 if (authentication_start_time_.is_null()) { | 179 if (authentication_start_time_.is_null()) { |
180 if (!username.empty()) | 180 if (!username.empty()) |
181 LOG(WARNING) << "authentication_start_time_ is not set"; | 181 LOG(WARNING) << "authentication_start_time_ is not set"; |
182 } else { | 182 } else { |
183 base::TimeDelta delta = base::Time::Now() - authentication_start_time_; | 183 base::TimeDelta delta = base::Time::Now() - authentication_start_time_; |
184 VLOG(1) << "Authentication success time: " << delta.InSecondsF(); | 184 VLOG(1) << "Authentication success time: " << delta.InSecondsF(); |
185 UMA_HISTOGRAM_TIMES("ScreenLocker.AuthenticationSuccessTime", delta); | 185 UMA_HISTOGRAM_TIMES("ScreenLocker.AuthenticationSuccessTime", delta); |
186 } | 186 } |
187 | 187 |
188 Profile* profile = ProfileManager::GetDefaultProfile(); | 188 Profile* profile = ProfileManager::GetDefaultProfile(); |
189 if (profile) { | 189 if (profile && !password.empty()) { |
190 ProfileSyncService* service( | 190 // We have a non-empty password, so notify listeners (such as the sync |
191 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile)); | 191 // engine). |
192 if (service && !service->HasSyncSetupCompleted()) { | 192 SigninManager* signin = SigninManagerFactory::GetForProfile(profile); |
193 SigninManager* signin = SigninManagerFactory::GetForProfile(profile); | 193 DCHECK(signin); |
194 DCHECK(signin); | 194 GoogleServiceSigninSuccessDetails details( |
195 GoogleServiceSigninSuccessDetails details( | 195 signin->GetAuthenticatedUsername(), |
196 signin->GetAuthenticatedUsername(), | 196 password); |
197 password); | 197 content::NotificationService::current()->Notify( |
198 content::NotificationService::current()->Notify( | 198 chrome::NOTIFICATION_GOOGLE_SIGNIN_SUCCESSFUL, |
199 chrome::NOTIFICATION_GOOGLE_SIGNIN_SUCCESSFUL, | 199 content::Source<Profile>(profile), |
200 content::Source<Profile>(profile), | 200 content::Details<const GoogleServiceSigninSuccessDetails>(&details)); |
201 content::Details<const GoogleServiceSigninSuccessDetails>(&details)); | |
202 } | |
203 } | 201 } |
204 DBusThreadManager::Get()->GetPowerManagerClient()-> | 202 DBusThreadManager::Get()->GetPowerManagerClient()-> |
205 NotifyScreenUnlockRequested(); | 203 NotifyScreenUnlockRequested(); |
206 | 204 |
207 if (login_status_consumer_) | 205 if (login_status_consumer_) |
208 login_status_consumer_->OnLoginSuccess(username, password, pending_requests, | 206 login_status_consumer_->OnLoginSuccess(username, password, pending_requests, |
209 using_oauth); | 207 using_oauth); |
210 } | 208 } |
211 | 209 |
212 void ScreenLocker::Authenticate(const string16& password) { | 210 void ScreenLocker::Authenticate(const string16& password) { |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 bool state = true; | 364 bool state = true; |
367 content::NotificationService::current()->Notify( | 365 content::NotificationService::current()->Notify( |
368 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, | 366 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, |
369 content::Source<ScreenLocker>(this), | 367 content::Source<ScreenLocker>(this), |
370 content::Details<bool>(&state)); | 368 content::Details<bool>(&state)); |
371 DBusThreadManager::Get()->GetPowerManagerClient()-> | 369 DBusThreadManager::Get()->GetPowerManagerClient()-> |
372 NotifyScreenLockCompleted(); | 370 NotifyScreenLockCompleted(); |
373 } | 371 } |
374 | 372 |
375 } // namespace chromeos | 373 } // namespace chromeos |
OLD | NEW |