Index: chrome/browser/chromeos/login/screen_locker.cc |
diff --git a/chrome/browser/chromeos/login/screen_locker.cc b/chrome/browser/chromeos/login/screen_locker.cc |
index 3915714005adf4db441a951e54e8e90d9b940fa1..b1827a4778581234452a144c5e10e7f4ef71ed25 100644 |
--- a/chrome/browser/chromeos/login/screen_locker.cc |
+++ b/chrome/browser/chromeos/login/screen_locker.cc |
@@ -257,6 +257,20 @@ void ScreenLocker::UnlockOnLoginSuccess() { |
void ScreenLocker::Authenticate(const UserContext& user_context) { |
LOG_ASSERT(IsUserLoggedIn(user_context.username)) |
<< "Invalid user trying to unlock."; |
+ |
+ // Send authentication request to app using chrome.screenlockPrivate API |
+ // if the authentication type is not the system password. |
+ LoginDisplay::AuthType auth_type = GetAuthType(user_context.username); |
+ if (auth_type != LoginDisplay::SYSTEM_PASSWORD) { |
+ Profile* profile = UserManager::Get()->GetProfileByUser( |
+ UserManager::Get()->GetActiveUser()); |
xiyuan
2014/02/16 18:38:14
This is not always the case when multi profile is
Tim Song
2014/02/18 23:32:44
It seems that ScreenLocker already assumes there i
xiyuan
2014/02/19 00:17:52
That is a bad assumption and we should not follow
Tim Song
2014/02/19 19:26:57
Done.
|
+ extensions::ScreenlockPrivateEventRouter* router = |
+ extensions::ScreenlockPrivateEventRouter::GetFactoryInstance() |
+ ->GetForProfile(profile); |
+ router->OnAuthAttempted(auth_type, user_context.password); |
xiyuan
2014/02/16 18:38:14
How do we get feedback from the auth attempt? What
Tim Song
2014/02/18 23:32:44
The app can unlock the screen if the auth attempt
xiyuan
2014/02/19 00:17:52
We do after we moved the "SetInputEnabled(false)"
Tim Song
2014/02/19 19:26:57
You're right. I added an acceptAuthAttempt() funct
xiyuan
2014/02/19 21:48:44
SGTM. I saw you call ScreenLocker::EnableInput in
|
+ return; |
+ } |
xiyuan
2014/02/16 18:38:14
Should we move the whole block under "delegate_->O
Tim Song
2014/02/18 23:32:44
Done.
|
+ |
authentication_start_time_ = base::Time::Now(); |
delegate_->SetInputEnabled(false); |
delegate_->OnAuthenticate(); |
@@ -304,10 +318,36 @@ void ScreenLocker::ShowUserPodButton(const std::string& username, |
screenlock_icon_provider_->AddIcon(username, icon); |
- // Append the current time to the URL so the image will not be cached. |
- std::string icon_url = ScreenlockIconSource::GetIconURLForUser(username) |
- + "?" + base::Int64ToString(base::Time::Now().ToInternalValue()); |
- delegate_->ShowUserPodButton(username, icon_url, click_callback); |
+ if (!username.empty()) { |
+ // Append the current time to the URL so the image will not be cached. |
+ std::string icon_url = |
+ ScreenlockIconSource::GetIconURLForUser(username) + "?" + |
+ base::Int64ToString(base::Time::Now().ToInternalValue()); |
xiyuan
2014/02/16 18:38:14
nit: prepend a "uniq=" to give the time a param na
Tim Song
2014/02/18 23:32:44
Done.
|
+ delegate_->ShowUserPodButton(username, icon_url, click_callback); |
+ } |
+} |
+ |
+void ScreenLocker::HideUserPodButton(const std::string& username) { |
+ if (!locked_) |
+ return; |
+ screenlock_icon_provider_->RemoveIcon(username); |
+ delegate_->HideUserPodButton(username); |
+} |
+ |
+void ScreenLocker::SetAuthType(const std::string& username, |
+ LoginDisplay::AuthType auth_type, |
+ const std::string& initial_value) { |
+ if (!locked_) |
+ return; |
+ delegate_->SetAuthType(username, auth_type, initial_value); |
+} |
+ |
+LoginDisplay::AuthType ScreenLocker::GetAuthType(const std::string& username) |
+ const { |
+ // Return default authentication type when not locked. |
+ if (!locked_) |
+ return LoginDisplay::SYSTEM_PASSWORD; |
+ return delegate_->GetAuthType(username); |
} |
void ScreenLocker::ShowErrorMessage(int error_msg_id, |