| Index: chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc
|
| diff --git a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc
|
| index b916b30931fa53287a5aea8c0174707d8b7778c5..3009f1bfebe84ec3f968d419933f2dd2db78bccd 100644
|
| --- a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc
|
| +++ b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc
|
| @@ -67,6 +67,7 @@
|
| #include "grit/generated_resources.h"
|
| #include "net/url_request/url_request_context_getter.h"
|
| #include "third_party/cros_system_api/dbus/service_constants.h"
|
| +#include "ui/base/webui/web_ui_util.h"
|
|
|
| #if defined(USE_AURA)
|
| #include "ash/shell.h"
|
| @@ -346,6 +347,7 @@ SigninScreenHandler::~SigninScreenHandler() {
|
| if (delegate_)
|
| delegate_->SetWebUIHandler(NULL);
|
| network_state_informer_->RemoveObserver(this);
|
| + ScreenlockBridge::Get()->SetLockHandler(NULL);
|
| }
|
|
|
| void SigninScreenHandler::DeclareLocalizedValues(
|
| @@ -792,8 +794,6 @@ void SigninScreenHandler::RegisterMessages() {
|
| AddCallback("updateOfflineLogin",
|
| &SigninScreenHandler::HandleUpdateOfflineLogin);
|
| AddCallback("focusPod", &SigninScreenHandler::HandleFocusPod);
|
| - AddCallback("customButtonClicked",
|
| - &SigninScreenHandler::HandleCustomButtonClicked);
|
| AddCallback("retrieveAuthenticatedUserEmail",
|
| &SigninScreenHandler::HandleRetrieveAuthenticatedUserEmail);
|
|
|
| @@ -859,53 +859,6 @@ void SigninScreenHandler::ResetSigninScreenHandlerDelegate() {
|
| SetDelegate(NULL);
|
| }
|
|
|
| -void SigninScreenHandler::ShowBannerMessage(const std::string& message) {
|
| - CallJS("login.AccountPickerScreen.showBannerMessage", message);
|
| -}
|
| -
|
| -void SigninScreenHandler::ShowUserPodButton(
|
| - const std::string& username,
|
| - const std::string& iconURL,
|
| - const base::Closure& click_callback) {
|
| - user_pod_button_callback_map_[username] = click_callback;
|
| - CallJS("login.AccountPickerScreen.showUserPodButton", username, iconURL);
|
| -
|
| - // TODO(tengs): Move this code once we move unlocking to native code.
|
| - if (ScreenLocker::default_screen_locker()) {
|
| - UserManager* user_manager = UserManager::Get();
|
| - const User* user = user_manager->FindUser(username);
|
| - if (!user)
|
| - return;
|
| - PrefService* profile_prefs =
|
| - user_manager->GetProfileByUser(user)->GetPrefs();
|
| - if (profile_prefs->GetBoolean(prefs::kEasyUnlockShowTutorial)) {
|
| - CallJS("login.AccountPickerScreen.showEasyUnlockBubble");
|
| - profile_prefs->SetBoolean(prefs::kEasyUnlockShowTutorial, false);
|
| - }
|
| - }
|
| -}
|
| -
|
| -void SigninScreenHandler::HideUserPodButton(const std::string& username) {
|
| - CallJS("login.AccountPickerScreen.hideUserPodButton", username);
|
| -}
|
| -
|
| -void SigninScreenHandler::SetAuthType(const std::string& username,
|
| - LoginDisplay::AuthType auth_type,
|
| - const std::string& initial_value) {
|
| - user_auth_type_map_[username] = auth_type;
|
| - CallJS("login.AccountPickerScreen.setAuthType",
|
| - username,
|
| - static_cast<int>(auth_type),
|
| - base::StringValue(initial_value));
|
| -}
|
| -
|
| -LoginDisplay::AuthType SigninScreenHandler::GetAuthType(
|
| - const std::string& username) const {
|
| - if (user_auth_type_map_.find(username) == user_auth_type_map_.end())
|
| - return LoginDisplay::OFFLINE_PASSWORD;
|
| - return user_auth_type_map_.find(username)->second;
|
| -}
|
| -
|
| void SigninScreenHandler::ShowError(int login_attempts,
|
| const std::string& error_text,
|
| const std::string& help_link_text,
|
| @@ -939,7 +892,7 @@ void SigninScreenHandler::ShowGaiaPasswordChanged(const std::string& username) {
|
| core_oobe_actor_->ShowSignInUI(email_);
|
| CallJS("login.setAuthType",
|
| username,
|
| - static_cast<int>(LoginDisplay::ONLINE_SIGN_IN),
|
| + static_cast<int>(ONLINE_SIGN_IN),
|
| base::StringValue(""));
|
| }
|
|
|
| @@ -1007,6 +960,64 @@ void SigninScreenHandler::Observe(int type,
|
| }
|
| }
|
|
|
| +void SigninScreenHandler::ShowBannerMessage(const std::string& message) {
|
| + CallJS("login.AccountPickerScreen.showBannerMessage", message);
|
| +}
|
| +
|
| +void SigninScreenHandler::ShowUserPodButton(
|
| + const std::string& username,
|
| + const gfx::Image& icon) {
|
| + GURL icon_url(webui::GetBitmapDataUrl(icon.AsBitmap()));
|
| + CallJS("login.AccountPickerScreen.showUserPodButton",
|
| + username, icon_url.spec());
|
| +
|
| + // TODO(tengs): Move this code once we move unlocking to native code.
|
| + if (ScreenLocker::default_screen_locker()) {
|
| + UserManager* user_manager = UserManager::Get();
|
| + const User* user = user_manager->FindUser(username);
|
| + if (!user)
|
| + return;
|
| + PrefService* profile_prefs =
|
| + user_manager->GetProfileByUser(user)->GetPrefs();
|
| + if (profile_prefs->GetBoolean(prefs::kEasyUnlockShowTutorial)) {
|
| + CallJS("login.AccountPickerScreen.showEasyUnlockBubble");
|
| + profile_prefs->SetBoolean(prefs::kEasyUnlockShowTutorial, false);
|
| + }
|
| + }
|
| +}
|
| +
|
| +void SigninScreenHandler::HideUserPodButton(const std::string& username) {
|
| + CallJS("login.AccountPickerScreen.hideUserPodButton", username);
|
| +}
|
| +
|
| +void SigninScreenHandler::EnableInput() {
|
| + // Only for lock screen at the moment.
|
| + ScreenLocker::default_screen_locker()->EnableInput();
|
| +}
|
| +
|
| +void SigninScreenHandler::SetAuthType(
|
| + const std::string& username,
|
| + ScreenlockBridge::LockHandler::AuthType auth_type,
|
| + const std::string& initial_value) {
|
| + user_auth_type_map_[username] = auth_type;
|
| + CallJS("login.AccountPickerScreen.setAuthType",
|
| + username,
|
| + static_cast<int>(auth_type),
|
| + base::StringValue(initial_value));
|
| +}
|
| +
|
| +ScreenlockBridge::LockHandler::AuthType SigninScreenHandler::GetAuthType(
|
| + const std::string& username) const {
|
| + if (user_auth_type_map_.find(username) == user_auth_type_map_.end())
|
| + return OFFLINE_PASSWORD;
|
| + return user_auth_type_map_.find(username)->second;
|
| +}
|
| +
|
| +void SigninScreenHandler::Unlock(const std::string& user_email) {
|
| + DCHECK(ScreenLocker::default_screen_locker());
|
| + ScreenLocker::Hide();
|
| +}
|
| +
|
| void SigninScreenHandler::OnDnsCleared() {
|
| DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
| dns_clear_task_running_ = false;
|
| @@ -1284,11 +1295,12 @@ void SigninScreenHandler::HandleToggleKioskAutolaunchScreen() {
|
| delegate_->ShowKioskAutolaunchScreen();
|
| }
|
|
|
| -void SigninScreenHandler::FillUserDictionary(User* user,
|
| - bool is_owner,
|
| - bool is_signin_to_add,
|
| - LoginDisplay::AuthType auth_type,
|
| - base::DictionaryValue* user_dict) {
|
| +void SigninScreenHandler::FillUserDictionary(
|
| + User* user,
|
| + bool is_owner,
|
| + bool is_signin_to_add,
|
| + ScreenlockBridge::LockHandler::AuthType auth_type,
|
| + base::DictionaryValue* user_dict) {
|
| const std::string& email = user->email();
|
| const bool is_public_account =
|
| user->GetType() == User::USER_TYPE_PUBLIC_ACCOUNT;
|
| @@ -1346,7 +1358,6 @@ void SigninScreenHandler::SendUserList(bool animated) {
|
| bool is_signin_to_add = LoginDisplayHostImpl::default_host() &&
|
| UserManager::Get()->IsUserLoggedIn();
|
|
|
| - user_pod_button_callback_map_.clear();
|
| user_auth_type_map_.clear();
|
|
|
| bool single_user = users.size() == 1;
|
| @@ -1370,9 +1381,8 @@ void SigninScreenHandler::SendUserList(bool animated) {
|
| if ((is_public_account && !is_signin_to_add) ||
|
| is_owner ||
|
| (!is_public_account && non_owner_count < max_non_owner_users)) {
|
| - LoginDisplay::AuthType initial_auth_type =
|
| - ShouldForceOnlineSignIn(*it) ? LoginDisplay::ONLINE_SIGN_IN
|
| - : LoginDisplay::OFFLINE_PASSWORD;
|
| + AuthType initial_auth_type =
|
| + ShouldForceOnlineSignIn(*it) ? ONLINE_SIGN_IN : OFFLINE_PASSWORD;
|
| user_auth_type_map_[email] = initial_auth_type;
|
|
|
| base::DictionaryValue* user_dict = new base::DictionaryValue();
|
| @@ -1424,8 +1434,10 @@ void SigninScreenHandler::HandleAccountPickerReady() {
|
| is_account_picker_showing_first_time_ = true;
|
| MaybePreloadAuthExtension();
|
|
|
| - if (ScreenLocker::default_screen_locker())
|
| + if (ScreenLocker::default_screen_locker()) {
|
| ScreenLocker::default_screen_locker()->delegate()->OnLockWebUIReady();
|
| + ScreenlockBridge::Get()->SetLockHandler(this);
|
| + }
|
|
|
| if (delegate_)
|
| delegate_->OnSigninScreenReady();
|
| @@ -1571,16 +1583,6 @@ void SigninScreenHandler::HandleFocusPod(const std::string& user_id) {
|
| WallpaperManager::Get()->SetUserWallpaperDelayed(user_id);
|
| }
|
|
|
| -void SigninScreenHandler::HandleCustomButtonClicked(
|
| - const std::string& username) {
|
| - if (user_pod_button_callback_map_.find(username)
|
| - == user_pod_button_callback_map_.end()) {
|
| - LOG(WARNING) << "User pod custom button clicked but no callback found";
|
| - return;
|
| - }
|
| - user_pod_button_callback_map_[username].Run();
|
| -}
|
| -
|
| void SigninScreenHandler::HandleRetrieveAuthenticatedUserEmail(
|
| double attempt_token) {
|
| email_retriever_.reset(new AuthenticatedUserEmailRetriever(
|
|
|