Chromium Code Reviews| 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 25 matching lines...) Expand all Loading... | |
| 36 #include "chrome/browser/ui/app_list/app_list_service.h" | 36 #include "chrome/browser/ui/app_list/app_list_service.h" |
| 37 #include "chrome/browser/ui/browser_commands.h" | 37 #include "chrome/browser/ui/browser_commands.h" |
| 38 #include "chrome/browser/ui/browser_dialogs.h" | 38 #include "chrome/browser/ui/browser_dialogs.h" |
| 39 #include "chrome/browser/ui/browser_finder.h" | 39 #include "chrome/browser/ui/browser_finder.h" |
| 40 #include "chrome/browser/ui/browser_list.h" | 40 #include "chrome/browser/ui/browser_list.h" |
| 41 #include "chrome/browser/ui/browser_list_observer.h" | 41 #include "chrome/browser/ui/browser_list_observer.h" |
| 42 #include "chrome/browser/ui/chrome_pages.h" | 42 #include "chrome/browser/ui/chrome_pages.h" |
| 43 #include "chrome/browser/ui/singleton_tabs.h" | 43 #include "chrome/browser/ui/singleton_tabs.h" |
| 44 #include "chrome/browser/ui/user_manager.h" | 44 #include "chrome/browser/ui/user_manager.h" |
| 45 #include "chrome/browser/ui/webui/profile_helper.h" | 45 #include "chrome/browser/ui/webui/profile_helper.h" |
| 46 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | |
| 47 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | |
| 46 #include "chrome/common/chrome_features.h" | 48 #include "chrome/common/chrome_features.h" |
| 47 #include "chrome/common/pref_names.h" | 49 #include "chrome/common/pref_names.h" |
| 48 #include "chrome/common/url_constants.h" | 50 #include "chrome/common/url_constants.h" |
| 49 #include "chrome/grit/chromium_strings.h" | 51 #include "chrome/grit/chromium_strings.h" |
| 50 #include "chrome/grit/generated_resources.h" | 52 #include "chrome/grit/generated_resources.h" |
| 51 #include "components/prefs/pref_service.h" | 53 #include "components/prefs/pref_service.h" |
| 52 #include "components/proximity_auth/screenlock_bridge.h" | 54 #include "components/proximity_auth/screenlock_bridge.h" |
| 53 #include "components/signin/core/account_id/account_id.h" | 55 #include "components/signin/core/account_id/account_id.h" |
| 54 #include "components/signin/core/common/profile_management_switches.h" | 56 #include "components/signin/core/common/profile_management_switches.h" |
| 55 #include "components/strings/grit/components_strings.h" | 57 #include "components/strings/grit/components_strings.h" |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 457 } | 459 } |
| 458 | 460 |
| 459 content::BrowserContext* browser_context = | 461 content::BrowserContext* browser_context = |
| 460 web_ui()->GetWebContents()->GetBrowserContext(); | 462 web_ui()->GetWebContents()->GetBrowserContext(); |
| 461 | 463 |
| 462 if (!email_address_.empty()) { | 464 if (!email_address_.empty()) { |
| 463 // In order to support the upgrade case where we have a local hash but no | 465 // In order to support the upgrade case where we have a local hash but no |
| 464 // password token, the user must perform a full online reauth. | 466 // password token, the user must perform a full online reauth. |
| 465 UserManager::ShowReauthDialog(browser_context, email_address_, | 467 UserManager::ShowReauthDialog(browser_context, email_address_, |
| 466 signin_metrics::Reason::REASON_UNLOCK); | 468 signin_metrics::Reason::REASON_UNLOCK); |
| 469 } else if (entry->IsSigninRequired() && entry->IsSupervised()) { | |
| 470 // Supervised profile will only be locked when force-sign-in is enabled | |
| 471 // and it shouldn't be unlocked. Display the error message directly via | |
| 472 // the system profile to avoid profile creation. | |
| 473 LoginUIServiceFactory::GetForProfile( | |
| 474 Profile::FromWebUI(web_ui())->GetOriginalProfile()) | |
| 475 ->DisplayLoginResult(nullptr, | |
| 476 l10n_util::GetStringUTF16( | |
| 477 IDS_SUPERVISED_USER_NOT_ALLOWED_BY_POLICY), | |
| 478 base::string16()); | |
| 479 UserManager::ShowSigninDialog(browser_context, profile_path); | |
|
anthonyvd
2016/12/05 18:56:37
Why is this showing the reauth dialog before showi
zmin
2016/12/08 20:42:43
Replace it with ShowDialogAndDisplayErrorMessage()
| |
| 480 UserManager::DisplayErrorMessage(); | |
| 467 } else { | 481 } else { |
| 468 // Fresh sign in via user manager without existing email address. | 482 // Fresh sign in via user manager without existing email address. |
| 469 UserManager::ShowSigninDialog(browser_context, profile_path); | 483 UserManager::ShowSigninDialog(browser_context, profile_path); |
| 470 } | 484 } |
| 471 } | 485 } |
| 472 | 486 |
| 473 void UserManagerScreenHandler::HandleRemoveUser(const base::ListValue* args) { | 487 void UserManagerScreenHandler::HandleRemoveUser(const base::ListValue* args) { |
| 474 DCHECK(args); | 488 DCHECK(args); |
| 475 const base::Value* profile_path_value; | 489 const base::Value* profile_path_value; |
| 476 if (!args->Get(0, &profile_path_value)) { | 490 if (!args->Get(0, &profile_path_value)) { |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1041 Profile* profile, Profile::CreateStatus profile_create_status) { | 1055 Profile* profile, Profile::CreateStatus profile_create_status) { |
| 1042 Browser* browser = chrome::FindAnyBrowser(profile, false); | 1056 Browser* browser = chrome::FindAnyBrowser(profile, false); |
| 1043 if (browser && browser->window()) { | 1057 if (browser && browser->window()) { |
| 1044 OnBrowserWindowReady(browser); | 1058 OnBrowserWindowReady(browser); |
| 1045 } else { | 1059 } else { |
| 1046 registrar_.Add(this, | 1060 registrar_.Add(this, |
| 1047 chrome::NOTIFICATION_BROWSER_WINDOW_READY, | 1061 chrome::NOTIFICATION_BROWSER_WINDOW_READY, |
| 1048 content::NotificationService::AllSources()); | 1062 content::NotificationService::AllSources()); |
| 1049 } | 1063 } |
| 1050 } | 1064 } |
| OLD | NEW |