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 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 kKeyUsername, info_cache.GetUserNameOfProfileAtIndex(i)); | 599 kKeyUsername, info_cache.GetUserNameOfProfileAtIndex(i)); |
600 profile_value->SetString( | 600 profile_value->SetString( |
601 kKeyEmailAddress, info_cache.GetUserNameOfProfileAtIndex(i)); | 601 kKeyEmailAddress, info_cache.GetUserNameOfProfileAtIndex(i)); |
602 // The profiles displayed in the User Manager are never guest profiles. | 602 // The profiles displayed in the User Manager are never guest profiles. |
603 profile_value->SetString( | 603 profile_value->SetString( |
604 kKeyDisplayName, | 604 kKeyDisplayName, |
605 profiles::GetAvatarNameForProfile(profile_path)); | 605 profiles::GetAvatarNameForProfile(profile_path)); |
606 profile_value->SetString(kKeyProfilePath, profile_path.MaybeAsASCII()); | 606 profile_value->SetString(kKeyProfilePath, profile_path.MaybeAsASCII()); |
607 profile_value->SetBoolean(kKeyPublicAccount, false); | 607 profile_value->SetBoolean(kKeyPublicAccount, false); |
608 profile_value->SetBoolean( | 608 profile_value->SetBoolean( |
609 kKeyLocallyManagedUser, info_cache.ProfileIsSupervisedAtIndex(i)); | 609 kKeySupervisedUser, info_cache.ProfileIsSupervisedAtIndex(i)); |
610 profile_value->SetBoolean(kKeySignedIn, is_active_user); | 610 profile_value->SetBoolean(kKeySignedIn, is_active_user); |
611 profile_value->SetBoolean( | 611 profile_value->SetBoolean( |
612 kKeyNeedsSignin, info_cache.ProfileIsSigninRequiredAtIndex(i)); | 612 kKeyNeedsSignin, info_cache.ProfileIsSigninRequiredAtIndex(i)); |
613 profile_value->SetBoolean(kKeyIsOwner, false); | 613 profile_value->SetBoolean(kKeyIsOwner, false); |
614 profile_value->SetBoolean(kKeyCanRemove, !active_user_is_supervised); | 614 profile_value->SetBoolean(kKeyCanRemove, !active_user_is_supervised); |
615 profile_value->SetBoolean(kKeyIsDesktop, true); | 615 profile_value->SetBoolean(kKeyIsDesktop, true); |
616 profile_value->SetString( | 616 profile_value->SetString( |
617 kKeyAvatarUrl, GetAvatarImageAtIndex(i, info_cache)); | 617 kKeyAvatarUrl, GetAvatarImageAtIndex(i, info_cache)); |
618 | 618 |
619 // The row of user pods should display the active user first. | 619 // The row of user pods should display the active user first. |
(...skipping 26 matching lines...) Expand all Loading... |
646 } else { | 646 } else { |
647 web_ui()->CallJavascriptFunction( | 647 web_ui()->CallJavascriptFunction( |
648 "cr.ui.Oobe.showSignInError", | 648 "cr.ui.Oobe.showSignInError", |
649 base::FundamentalValue(0), | 649 base::FundamentalValue(0), |
650 base::StringValue( | 650 base::StringValue( |
651 l10n_util::GetStringUTF8(IDS_LOGIN_ERROR_AUTHENTICATING)), | 651 l10n_util::GetStringUTF8(IDS_LOGIN_ERROR_AUTHENTICATING)), |
652 base::StringValue(""), | 652 base::StringValue(""), |
653 base::FundamentalValue(0)); | 653 base::FundamentalValue(0)); |
654 } | 654 } |
655 } | 655 } |
OLD | NEW |