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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "base/value_conversions.h" | 9 #include "base/value_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "chrome/browser/supervised_user/supervised_user_service.h" | 42 #include "chrome/browser/supervised_user/supervised_user_service.h" |
43 #endif | 43 #endif |
44 | 44 |
45 namespace { | 45 namespace { |
46 // User dictionary keys. | 46 // User dictionary keys. |
47 const char kKeyUsername[] = "username"; | 47 const char kKeyUsername[] = "username"; |
48 const char kKeyDisplayName[]= "displayName"; | 48 const char kKeyDisplayName[]= "displayName"; |
49 const char kKeyEmailAddress[] = "emailAddress"; | 49 const char kKeyEmailAddress[] = "emailAddress"; |
50 const char kKeyProfilePath[] = "profilePath"; | 50 const char kKeyProfilePath[] = "profilePath"; |
51 const char kKeyPublicAccount[] = "publicAccount"; | 51 const char kKeyPublicAccount[] = "publicAccount"; |
52 const char kKeyLocallyManagedUser[] = "locallyManagedUser"; | 52 const char kKeySupervisedUser[] = "supervisedUser"; |
53 const char kKeySignedIn[] = "signedIn"; | 53 const char kKeySignedIn[] = "signedIn"; |
54 const char kKeyCanRemove[] = "canRemove"; | 54 const char kKeyCanRemove[] = "canRemove"; |
55 const char kKeyIsOwner[] = "isOwner"; | 55 const char kKeyIsOwner[] = "isOwner"; |
56 const char kKeyIsDesktop[] = "isDesktopUser"; | 56 const char kKeyIsDesktop[] = "isDesktopUser"; |
57 const char kKeyAvatarUrl[] = "userImage"; | 57 const char kKeyAvatarUrl[] = "userImage"; |
58 const char kKeyNeedsSignin[] = "needsSignin"; | 58 const char kKeyNeedsSignin[] = "needsSignin"; |
59 | 59 |
60 // JS API callback names. | 60 // JS API callback names. |
61 const char kJsApiUserManagerInitialize[] = "userManagerInitialize"; | 61 const char kJsApiUserManagerInitialize[] = "userManagerInitialize"; |
62 const char kJsApiUserManagerAddUser[] = "addUser"; | 62 const char kJsApiUserManagerAddUser[] = "addUser"; |
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 kKeyUsername, info_cache.GetUserNameOfProfileAtIndex(i)); | 605 kKeyUsername, info_cache.GetUserNameOfProfileAtIndex(i)); |
606 profile_value->SetString( | 606 profile_value->SetString( |
607 kKeyEmailAddress, info_cache.GetUserNameOfProfileAtIndex(i)); | 607 kKeyEmailAddress, info_cache.GetUserNameOfProfileAtIndex(i)); |
608 // The profiles displayed in the User Manager are never guest profiles. | 608 // The profiles displayed in the User Manager are never guest profiles. |
609 profile_value->SetString( | 609 profile_value->SetString( |
610 kKeyDisplayName, | 610 kKeyDisplayName, |
611 profiles::GetAvatarNameForProfile(profile_path)); | 611 profiles::GetAvatarNameForProfile(profile_path)); |
612 profile_value->SetString(kKeyProfilePath, profile_path.MaybeAsASCII()); | 612 profile_value->SetString(kKeyProfilePath, profile_path.MaybeAsASCII()); |
613 profile_value->SetBoolean(kKeyPublicAccount, false); | 613 profile_value->SetBoolean(kKeyPublicAccount, false); |
614 profile_value->SetBoolean( | 614 profile_value->SetBoolean( |
615 kKeyLocallyManagedUser, info_cache.ProfileIsSupervisedAtIndex(i)); | 615 kKeySupervisedUser, info_cache.ProfileIsSupervisedAtIndex(i)); |
616 profile_value->SetBoolean(kKeySignedIn, is_active_user); | 616 profile_value->SetBoolean(kKeySignedIn, is_active_user); |
617 profile_value->SetBoolean( | 617 profile_value->SetBoolean( |
618 kKeyNeedsSignin, info_cache.ProfileIsSigninRequiredAtIndex(i)); | 618 kKeyNeedsSignin, info_cache.ProfileIsSigninRequiredAtIndex(i)); |
619 profile_value->SetBoolean(kKeyIsOwner, false); | 619 profile_value->SetBoolean(kKeyIsOwner, false); |
620 profile_value->SetBoolean(kKeyCanRemove, !active_user_is_supervised); | 620 profile_value->SetBoolean(kKeyCanRemove, !active_user_is_supervised); |
621 profile_value->SetBoolean(kKeyIsDesktop, true); | 621 profile_value->SetBoolean(kKeyIsDesktop, true); |
622 profile_value->SetString( | 622 profile_value->SetString( |
623 kKeyAvatarUrl, GetAvatarImageAtIndex(i, info_cache)); | 623 kKeyAvatarUrl, GetAvatarImageAtIndex(i, info_cache)); |
624 | 624 |
625 // The row of user pods should display the active user first. | 625 // The row of user pods should display the active user first. |
(...skipping 26 matching lines...) Expand all Loading... |
652 } else { | 652 } else { |
653 web_ui()->CallJavascriptFunction( | 653 web_ui()->CallJavascriptFunction( |
654 "cr.ui.Oobe.showSignInError", | 654 "cr.ui.Oobe.showSignInError", |
655 base::FundamentalValue(0), | 655 base::FundamentalValue(0), |
656 base::StringValue( | 656 base::StringValue( |
657 l10n_util::GetStringUTF8(IDS_LOGIN_ERROR_AUTHENTICATING)), | 657 l10n_util::GetStringUTF8(IDS_LOGIN_ERROR_AUTHENTICATING)), |
658 base::StringValue(""), | 658 base::StringValue(""), |
659 base::FundamentalValue(0)); | 659 base::FundamentalValue(0)); |
660 } | 660 } |
661 } | 661 } |
OLD | NEW |