OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/signin_create_profile_handler.h" | 5 #include "chrome/browser/ui/webui/signin/signin_create_profile_handler.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 // Chrome to close. | 485 // Chrome to close. |
486 if (browser && browser->window()) { | 486 if (browser && browser->window()) { |
487 UserManager::Hide(); | 487 UserManager::Hide(); |
488 } else { | 488 } else { |
489 registrar_.Add(this, | 489 registrar_.Add(this, |
490 chrome::NOTIFICATION_BROWSER_WINDOW_READY, | 490 chrome::NOTIFICATION_BROWSER_WINDOW_READY, |
491 content::NotificationService::AllSources()); | 491 content::NotificationService::AllSources()); |
492 } | 492 } |
493 } | 493 } |
494 | 494 |
| 495 base::StringValue SigninCreateProfileHandler::GetWebUIListenerName( |
| 496 ProfileCreationStatus status) const { |
| 497 switch (status) { |
| 498 case PROFILE_CREATION_SUCCESS: |
| 499 return base::StringValue("create-profile-success"); |
| 500 case PROFILE_CREATION_ERROR: |
| 501 return base::StringValue("create-profile-error"); |
| 502 } |
| 503 NOTREACHED(); |
| 504 return base::StringValue(std::string()); |
| 505 } |
| 506 |
495 #if defined(ENABLE_SUPERVISED_USERS) | 507 #if defined(ENABLE_SUPERVISED_USERS) |
496 base::string16 SigninCreateProfileHandler::GetProfileCreateErrorMessageRemote() | 508 base::string16 SigninCreateProfileHandler::GetProfileCreateErrorMessageRemote() |
497 const { | 509 const { |
498 return l10n_util::GetStringUTF16( | 510 return l10n_util::GetStringUTF16( |
499 profile_creation_type_ == SUPERVISED_PROFILE_IMPORT | 511 profile_creation_type_ == SUPERVISED_PROFILE_IMPORT |
500 ? IDS_LEGACY_SUPERVISED_USER_IMPORT_REMOTE_ERROR | 512 ? IDS_LEGACY_SUPERVISED_USER_IMPORT_REMOTE_ERROR |
501 : IDS_PROFILES_CREATE_REMOTE_ERROR); | 513 : IDS_PROFILES_CREATE_REMOTE_ERROR); |
502 } | 514 } |
503 | 515 |
504 base::string16 SigninCreateProfileHandler::GetProfileCreateErrorMessageSignin() | 516 base::string16 SigninCreateProfileHandler::GetProfileCreateErrorMessageSignin() |
505 const { | 517 const { |
506 return l10n_util::GetStringUTF16( | 518 return l10n_util::GetStringUTF16( |
507 profile_creation_type_ == SUPERVISED_PROFILE_IMPORT | 519 profile_creation_type_ == SUPERVISED_PROFILE_IMPORT |
508 ? IDS_LEGACY_SUPERVISED_USER_IMPORT_SIGN_IN_ERROR | 520 ? IDS_LEGACY_SUPERVISED_USER_IMPORT_SIGN_IN_ERROR |
509 : IDS_PROFILES_CREATE_SIGN_IN_ERROR); | 521 : IDS_PROFILES_CREATE_SIGN_IN_ERROR); |
510 } | 522 } |
511 #endif | |
512 | 523 |
513 base::StringValue SigninCreateProfileHandler::GetWebUIListenerName( | |
514 ProfileCreationStatus status) const { | |
515 switch (status) { | |
516 case PROFILE_CREATION_SUCCESS: | |
517 return base::StringValue("create-profile-success"); | |
518 case PROFILE_CREATION_ERROR: | |
519 return base::StringValue("create-profile-error"); | |
520 } | |
521 NOTREACHED(); | |
522 return base::StringValue(std::string()); | |
523 } | |
524 | |
525 #if defined(ENABLE_SUPERVISED_USERS) | |
526 bool SigninCreateProfileHandler::GetSupervisedCreateProfileArgs( | 524 bool SigninCreateProfileHandler::GetSupervisedCreateProfileArgs( |
527 const base::ListValue* args, | 525 const base::ListValue* args, |
528 std::string* supervised_user_id, | 526 std::string* supervised_user_id, |
529 base::FilePath* custodian_profile_path) { | 527 base::FilePath* custodian_profile_path) { |
530 bool supervised_user = false; | 528 bool supervised_user = false; |
531 bool success = args->GetBoolean(3, &supervised_user); | 529 bool success = args->GetBoolean(3, &supervised_user); |
532 DCHECK(success); | 530 DCHECK(success); |
533 | 531 |
534 if (!supervised_user) | 532 if (!supervised_user) |
535 return false; | 533 return false; |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 DCHECK(profile); | 801 DCHECK(profile); |
804 | 802 |
805 profiles::OpenBrowserWindowForProfile( | 803 profiles::OpenBrowserWindowForProfile( |
806 base::Bind(&SigninCreateProfileHandler::OnBrowserReadyCallback, | 804 base::Bind(&SigninCreateProfileHandler::OnBrowserReadyCallback, |
807 weak_ptr_factory_.GetWeakPtr()), | 805 weak_ptr_factory_.GetWeakPtr()), |
808 false, // Don't create a window if one already exists. | 806 false, // Don't create a window if one already exists. |
809 true, // Create a first run window. | 807 true, // Create a first run window. |
810 profile, | 808 profile, |
811 Profile::CREATE_STATUS_INITIALIZED); | 809 Profile::CREATE_STATUS_INITIALIZED); |
812 } | 810 } |
813 | |
814 #endif | 811 #endif |
OLD | NEW |