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 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 | 486 |
487 base::FilePath profile_path; | 487 base::FilePath profile_path; |
488 if (!base::GetValueAsFilePath(*profile_path_value, &profile_path)) { | 488 if (!base::GetValueAsFilePath(*profile_path_value, &profile_path)) { |
489 NOTREACHED(); | 489 NOTREACHED(); |
490 return; | 490 return; |
491 } | 491 } |
492 | 492 |
493 DCHECK(profiles::IsMultipleProfilesEnabled()); | 493 DCHECK(profiles::IsMultipleProfilesEnabled()); |
494 | 494 |
495 if (switches::IsMaterialDesignUserManager() && | 495 if (switches::IsMaterialDesignUserManager() && |
496 profiles::AreAllProfilesLocked()) { | 496 profiles::AreAllNonChildNonSupervisedProfilesLocked()) { |
497 web_ui()->CallJavascriptFunctionUnsafe( | 497 web_ui()->CallJavascriptFunctionUnsafe( |
498 "cr.webUIListenerCallback", | 498 "cr.webUIListenerCallback", |
499 base::StringValue("show-error-dialog"), | 499 base::StringValue("show-error-dialog"), |
500 base::StringValue(l10n_util::GetStringUTF8( | 500 base::StringValue(l10n_util::GetStringUTF8( |
501 IDS_USER_MANAGER_REMOVE_PROFILE_PROFILES_LOCKED_ERROR))); | 501 IDS_USER_MANAGER_REMOVE_PROFILE_PROFILES_LOCKED_ERROR))); |
502 return; | 502 return; |
503 } | 503 } |
504 | 504 |
505 // The callback is run if the only profile has been deleted, and a new | 505 // The callback is run if the only profile has been deleted, and a new |
506 // profile has been created to replace it. | 506 // profile has been created to replace it. |
(...skipping 17 matching lines...) Expand all Loading... |
524 void UserManagerScreenHandler::HandleAreAllProfilesLocked( | 524 void UserManagerScreenHandler::HandleAreAllProfilesLocked( |
525 const base::ListValue* args) { | 525 const base::ListValue* args) { |
526 std::string webui_callback_id; | 526 std::string webui_callback_id; |
527 CHECK_EQ(1U, args->GetSize()); | 527 CHECK_EQ(1U, args->GetSize()); |
528 bool success = args->GetString(0, &webui_callback_id); | 528 bool success = args->GetString(0, &webui_callback_id); |
529 DCHECK(success); | 529 DCHECK(success); |
530 | 530 |
531 AllowJavascript(); | 531 AllowJavascript(); |
532 ResolveJavascriptCallback( | 532 ResolveJavascriptCallback( |
533 base::StringValue(webui_callback_id), | 533 base::StringValue(webui_callback_id), |
534 base::FundamentalValue(profiles::AreAllProfilesLocked())); | 534 base::FundamentalValue( |
| 535 profiles::AreAllNonChildNonSupervisedProfilesLocked())); |
535 } | 536 } |
536 | 537 |
537 void UserManagerScreenHandler::HandleLaunchUser(const base::ListValue* args) { | 538 void UserManagerScreenHandler::HandleLaunchUser(const base::ListValue* args) { |
538 const base::Value* profile_path_value = NULL; | 539 const base::Value* profile_path_value = NULL; |
539 if (!args->Get(0, &profile_path_value)) | 540 if (!args->Get(0, &profile_path_value)) |
540 return; | 541 return; |
541 | 542 |
542 base::FilePath profile_path; | 543 base::FilePath profile_path; |
543 if (!base::GetValueAsFilePath(*profile_path_value, &profile_path)) | 544 if (!base::GetValueAsFilePath(*profile_path_value, &profile_path)) |
544 return; | 545 return; |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 Profile* profile, Profile::CreateStatus profile_create_status) { | 1039 Profile* profile, Profile::CreateStatus profile_create_status) { |
1039 Browser* browser = chrome::FindAnyBrowser(profile, false); | 1040 Browser* browser = chrome::FindAnyBrowser(profile, false); |
1040 if (browser && browser->window()) { | 1041 if (browser && browser->window()) { |
1041 OnBrowserWindowReady(browser); | 1042 OnBrowserWindowReady(browser); |
1042 } else { | 1043 } else { |
1043 registrar_.Add(this, | 1044 registrar_.Add(this, |
1044 chrome::NOTIFICATION_BROWSER_WINDOW_READY, | 1045 chrome::NOTIFICATION_BROWSER_WINDOW_READY, |
1045 content::NotificationService::AllSources()); | 1046 content::NotificationService::AllSources()); |
1046 } | 1047 } |
1047 } | 1048 } |
OLD | NEW |