Chromium Code Reviews| 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 ca89fd97ecb8b1bdb64b475afea48a07e63691a2..a454b534c17e99993d7bccb81ea7f459f876839b 100644 |
| --- a/chrome/browser/chromeos/login/screen_locker.cc |
| +++ b/chrome/browser/chromeos/login/screen_locker.cc |
| @@ -38,6 +38,7 @@ |
| #include "chrome/browser/lifetime/application_lifetime.h" |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/browser/profiles/profile_manager.h" |
| +#include "chrome/browser/signin/screenlock_bridge.h" |
| #include "chrome/browser/signin/signin_manager_factory.h" |
| #include "chrome/browser/sync/profile_sync_service.h" |
| #include "chrome/browser/sync/profile_sync_service_factory.h" |
| @@ -123,39 +124,6 @@ class ScreenLockObserver : public SessionManagerClient::StubDelegate, |
| ScreenLockObserver* g_screen_lock_observer = NULL; |
| -// TODO(xiyuan): Get rid of LoginDisplay::AuthType and the mappers below. |
| -ScreenlockBridge::LockHandler::AuthType ToLockHandlerAuthType( |
| - LoginDisplay::AuthType auth_type) { |
| - switch (auth_type) { |
| - case LoginDisplay::OFFLINE_PASSWORD: |
| - return ScreenlockBridge::LockHandler::OFFLINE_PASSWORD; |
| - case LoginDisplay::ONLINE_SIGN_IN: |
| - return ScreenlockBridge::LockHandler::ONLINE_SIGN_IN; |
| - case LoginDisplay::NUMERIC_PIN: |
| - return ScreenlockBridge::LockHandler::NUMERIC_PIN; |
| - case LoginDisplay::USER_CLICK: |
| - return ScreenlockBridge::LockHandler::USER_CLICK; |
| - } |
| - NOTREACHED(); |
| - return ScreenlockBridge::LockHandler::OFFLINE_PASSWORD; |
| -} |
| - |
| -LoginDisplay::AuthType FromLockHandlerAuthType( |
| - ScreenlockBridge::LockHandler::AuthType auth_type) { |
| - switch (auth_type) { |
| - case ScreenlockBridge::LockHandler::OFFLINE_PASSWORD: |
| - return LoginDisplay::OFFLINE_PASSWORD; |
| - case ScreenlockBridge::LockHandler::ONLINE_SIGN_IN: |
| - return LoginDisplay::ONLINE_SIGN_IN; |
| - case ScreenlockBridge::LockHandler::NUMERIC_PIN: |
| - return LoginDisplay::NUMERIC_PIN; |
| - case ScreenlockBridge::LockHandler::USER_CLICK: |
| - return LoginDisplay::USER_CLICK; |
| - } |
| - NOTREACHED(); |
| - return LoginDisplay::OFFLINE_PASSWORD; |
| -} |
| - |
| } // namespace |
| // static |
| @@ -292,9 +260,10 @@ void ScreenLocker::Authenticate(const UserContext& user_context) { |
| // Send authentication request to chrome.screenlockPrivate API event router |
| // if the authentication type is not the system password. |
| - LoginDisplay::AuthType auth_type = |
| - FromLockHandlerAuthType(GetAuthType(user_context.GetUserID())); |
| - if (auth_type != LoginDisplay::OFFLINE_PASSWORD) { |
| + ScreenlockBridge::LockHandler::AuthType auth_type = |
| + ScreenlockBridge::Get()->lock_handler()->GetAuthType( |
| + user_context.GetUserID()); |
| + if (auth_type != ScreenlockBridge::LockHandler::OFFLINE_PASSWORD) { |
|
Tim Song
2014/05/16 18:38:47
Does it still make sense to wire up the OnAuthAtte
xiyuan
2014/05/16 23:00:56
Done.
|
| const User* unlock_user = FindUnlockUser(user_context.GetUserID()); |
| LOG_ASSERT(unlock_user); |
| @@ -302,7 +271,7 @@ void ScreenLocker::Authenticate(const UserContext& user_context) { |
| extensions::ScreenlockPrivateEventRouter* router = |
| extensions::ScreenlockPrivateEventRouter::GetFactoryInstance()->Get( |
| profile); |
| - router->OnAuthAttempted(ToLockHandlerAuthType(auth_type), |
| + router->OnAuthAttempted(auth_type, |
| user_context.GetPassword()); |
| return; |
| } |
| @@ -363,60 +332,10 @@ void ScreenLocker::Signout() { |
| // briefly. |
| } |
| -void ScreenLocker::ShowBannerMessage(const std::string& message) { |
| - delegate_->ShowBannerMessage(message); |
| -} |
| - |
| -void ScreenLocker::ShowUserPodButton(const std::string& username, |
| - const gfx::Image& icon, |
| - const base::Closure& click_callback) { |
| - if (!locked_) |
| - return; |
| - |
| - screenlock_icon_provider_->AddIcon(username, icon); |
| - |
| - if (!username.empty()) { |
| - // Append the current time to the URL so the image will not be cached. |
| - std::string icon_url = |
| - ScreenlockIconSource::GetIconURLForUser(username) + "?uniq=" + |
| - base::Int64ToString(base::Time::Now().ToInternalValue()); |
| - 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::EnableInput() { |
| delegate_->SetInputEnabled(true); |
| } |
| -void ScreenLocker::SetAuthType( |
| - const std::string& username, |
| - ScreenlockBridge::LockHandler::AuthType auth_type, |
| - const std::string& initial_value) { |
| - if (!locked_) |
| - return; |
| - delegate_->SetAuthType( |
| - username, FromLockHandlerAuthType(auth_type), initial_value); |
| -} |
| - |
| -ScreenlockBridge::LockHandler::AuthType ScreenLocker::GetAuthType( |
| - const std::string& username) const { |
| - // Return default authentication type when not locked. |
| - if (!locked_) |
| - return ScreenlockBridge::LockHandler::OFFLINE_PASSWORD; |
| - return ToLockHandlerAuthType(delegate_->GetAuthType(username)); |
| -} |
| - |
| -void ScreenLocker::Unlock(const std::string& user_email) { |
| - chromeos::ScreenLocker::Hide(); |
| -} |
| - |
| void ScreenLocker::ShowErrorMessage(int error_msg_id, |
| HelpAppLauncher::HelpTopic help_topic_id, |
| bool sign_out_only) { |
| @@ -588,8 +507,6 @@ void ScreenLocker::ScreenLockReady() { |
| content::Details<bool>(&state)); |
| VLOG(1) << "Calling session manager's HandleLockScreenShown D-Bus method"; |
| DBusThreadManager::Get()->GetSessionManagerClient()->NotifyLockScreenShown(); |
| - |
| - ScreenlockBridge::Get()->SetLockHandler(this); |
| } |
| content::WebUI* ScreenLocker::GetAssociatedWebUI() { |