| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/webui/signin/user_manager_screen_handler.h" | 5 #include "chrome/browser/ui/webui/signin/user_manager_screen_handler.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 "login.AccountPickerScreen.hideUserPodCustomIcon", | 343 "login.AccountPickerScreen.hideUserPodCustomIcon", |
| 344 base::Value(account_id.GetUserEmail())); | 344 base::Value(account_id.GetUserEmail())); |
| 345 } | 345 } |
| 346 | 346 |
| 347 void UserManagerScreenHandler::EnableInput() { | 347 void UserManagerScreenHandler::EnableInput() { |
| 348 // Nothing here because UI is not disabled when starting to authenticate. | 348 // Nothing here because UI is not disabled when starting to authenticate. |
| 349 } | 349 } |
| 350 | 350 |
| 351 void UserManagerScreenHandler::SetAuthType( | 351 void UserManagerScreenHandler::SetAuthType( |
| 352 const AccountId& account_id, | 352 const AccountId& account_id, |
| 353 proximity_auth::ScreenlockBridge::LockHandler::AuthType auth_type, | 353 proximity_auth::mojom::AuthType auth_type, |
| 354 const base::string16& auth_value) { | 354 const base::string16& auth_value) { |
| 355 if (GetAuthType(account_id) == | 355 if (GetAuthType(account_id) == |
| 356 proximity_auth::ScreenlockBridge::LockHandler::FORCE_OFFLINE_PASSWORD) | 356 proximity_auth::mojom::AuthType::FORCE_OFFLINE_PASSWORD) { |
| 357 return; | 357 return; |
| 358 } |
| 358 | 359 |
| 359 user_auth_type_map_[account_id.GetUserEmail()] = auth_type; | 360 user_auth_type_map_[account_id.GetUserEmail()] = auth_type; |
| 360 web_ui()->CallJavascriptFunctionUnsafe( | 361 web_ui()->CallJavascriptFunctionUnsafe( |
| 361 "login.AccountPickerScreen.setAuthType", | 362 "login.AccountPickerScreen.setAuthType", |
| 362 base::Value(account_id.GetUserEmail()), base::Value(auth_type), | 363 base::Value(account_id.GetUserEmail()), |
| 363 base::Value(auth_value)); | 364 base::Value(static_cast<int>(auth_type)), base::Value(auth_value)); |
| 364 } | 365 } |
| 365 | 366 |
| 366 proximity_auth::ScreenlockBridge::LockHandler::AuthType | 367 proximity_auth::mojom::AuthType UserManagerScreenHandler::GetAuthType( |
| 367 UserManagerScreenHandler::GetAuthType(const AccountId& account_id) const { | 368 const AccountId& account_id) const { |
| 368 const auto it = user_auth_type_map_.find(account_id.GetUserEmail()); | 369 const auto it = user_auth_type_map_.find(account_id.GetUserEmail()); |
| 369 if (it == user_auth_type_map_.end()) | 370 if (it == user_auth_type_map_.end()) |
| 370 return proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD; | 371 return proximity_auth::mojom::AuthType::OFFLINE_PASSWORD; |
| 371 return it->second; | 372 return it->second; |
| 372 } | 373 } |
| 373 | 374 |
| 374 proximity_auth::ScreenlockBridge::LockHandler::ScreenType | 375 proximity_auth::ScreenlockBridge::LockHandler::ScreenType |
| 375 UserManagerScreenHandler::GetScreenType() const { | 376 UserManagerScreenHandler::GetScreenType() const { |
| 376 return proximity_auth::ScreenlockBridge::LockHandler::LOCK_SCREEN; | 377 return proximity_auth::ScreenlockBridge::LockHandler::LOCK_SCREEN; |
| 377 } | 378 } |
| 378 | 379 |
| 379 void UserManagerScreenHandler::Unlock(const AccountId& account_id) { | 380 void UserManagerScreenHandler::Unlock(const AccountId& account_id) { |
| 380 const base::FilePath path = profiles::GetPathOfProfileWithEmail( | 381 const base::FilePath path = profiles::GetPathOfProfileWithEmail( |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 CHECK(args->GetString(0, &email)); | 575 CHECK(args->GetString(0, &email)); |
| 575 GetScreenlockRouter(email) | 576 GetScreenlockRouter(email) |
| 576 ->OnAuthAttempted(GetAuthType(AccountId::FromUserEmail(email)), ""); | 577 ->OnAuthAttempted(GetAuthType(AccountId::FromUserEmail(email)), ""); |
| 577 } | 578 } |
| 578 | 579 |
| 579 void UserManagerScreenHandler::HandleHardlockUserPod( | 580 void UserManagerScreenHandler::HandleHardlockUserPod( |
| 580 const base::ListValue* args) { | 581 const base::ListValue* args) { |
| 581 std::string email; | 582 std::string email; |
| 582 CHECK(args->GetString(0, &email)); | 583 CHECK(args->GetString(0, &email)); |
| 583 const AccountId account_id = AccountId::FromUserEmail(email); | 584 const AccountId account_id = AccountId::FromUserEmail(email); |
| 584 SetAuthType( | 585 SetAuthType(account_id, |
| 585 account_id, | 586 proximity_auth::mojom::AuthType::FORCE_OFFLINE_PASSWORD, |
| 586 proximity_auth::ScreenlockBridge::LockHandler::FORCE_OFFLINE_PASSWORD, | 587 base::string16()); |
| 587 base::string16()); | |
| 588 HideUserPodCustomIcon(account_id); | 588 HideUserPodCustomIcon(account_id); |
| 589 } | 589 } |
| 590 | 590 |
| 591 void UserManagerScreenHandler::HandleRemoveUserWarningLoadStats( | 591 void UserManagerScreenHandler::HandleRemoveUserWarningLoadStats( |
| 592 const base::ListValue* args) { | 592 const base::ListValue* args) { |
| 593 const base::Value* profile_path_value; | 593 const base::Value* profile_path_value; |
| 594 | 594 |
| 595 if (!args->Get(0, &profile_path_value)) | 595 if (!args->Get(0, &profile_path_value)) |
| 596 return; | 596 return; |
| 597 | 597 |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1042 Profile* profile, Profile::CreateStatus profile_create_status) { | 1042 Profile* profile, Profile::CreateStatus profile_create_status) { |
| 1043 Browser* browser = chrome::FindAnyBrowser(profile, false); | 1043 Browser* browser = chrome::FindAnyBrowser(profile, false); |
| 1044 if (browser && browser->window()) { | 1044 if (browser && browser->window()) { |
| 1045 OnBrowserWindowReady(browser); | 1045 OnBrowserWindowReady(browser); |
| 1046 } else { | 1046 } else { |
| 1047 registrar_.Add(this, | 1047 registrar_.Add(this, |
| 1048 chrome::NOTIFICATION_BROWSER_WINDOW_READY, | 1048 chrome::NOTIFICATION_BROWSER_WINDOW_READY, |
| 1049 content::NotificationService::AllSources()); | 1049 content::NotificationService::AllSources()); |
| 1050 } | 1050 } |
| 1051 } | 1051 } |
| OLD | NEW |