OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chromeos/login/signin_screen_handler.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
61 "chrome-extension://mfffpogegjflfpflabcdkioaeobkgjik/main.html"; | 61 "chrome-extension://mfffpogegjflfpflabcdkioaeobkgjik/main.html"; |
62 // Same as above but offline version. | 62 // Same as above but offline version. |
63 const char kGaiaExtStartPageOffline[] = | 63 const char kGaiaExtStartPageOffline[] = |
64 "chrome-extension://mfffpogegjflfpflabcdkioaeobkgjik/offline.html"; | 64 "chrome-extension://mfffpogegjflfpflabcdkioaeobkgjik/offline.html"; |
65 | 65 |
66 // User dictionary keys. | 66 // User dictionary keys. |
67 const char kKeyUsername[] = "username"; | 67 const char kKeyUsername[] = "username"; |
68 const char kKeyDisplayName[] = "displayName"; | 68 const char kKeyDisplayName[] = "displayName"; |
69 const char kKeyEmailAddress[] = "emailAddress"; | 69 const char kKeyEmailAddress[] = "emailAddress"; |
70 const char kKeyNameTooltip[] = "nameTooltip"; | 70 const char kKeyNameTooltip[] = "nameTooltip"; |
71 const char kKeyPublicAccount[] = "publicAccount"; | |
Ivan Korotkov
2012/11/28 21:40:53
Like I said before, "public" sounds strange so may
bartfab (slow)
2012/11/29 14:18:09
As discussed, leaving as-is after clarifying that
| |
71 const char kKeySignedIn[] = "signedIn"; | 72 const char kKeySignedIn[] = "signedIn"; |
72 const char kKeyCanRemove[] = "canRemove"; | 73 const char kKeyCanRemove[] = "canRemove"; |
73 const char kKeyOauthTokenStatus[] = "oauthTokenStatus"; | 74 const char kKeyOauthTokenStatus[] = "oauthTokenStatus"; |
74 | 75 |
75 // Max number of users to show. | 76 // Max number of users to show. |
76 const size_t kMaxUsers = 5; | 77 const size_t kMaxUsers = 5; |
77 | 78 |
78 // The Task posted to PostTaskAndReply in StartClearingDnsCache on the IO | 79 // The Task posted to PostTaskAndReply in StartClearingDnsCache on the IO |
79 // thread. | 80 // thread. |
80 void ClearDnsCache(IOThread* io_thread) { | 81 void ClearDnsCache(IOThread* io_thread) { |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
728 | 729 |
729 ListValue users_list; | 730 ListValue users_list; |
730 const UserList& users = delegate_->GetUsers(); | 731 const UserList& users = delegate_->GetUsers(); |
731 | 732 |
732 bool single_user = users.size() == 1; | 733 bool single_user = users.size() == 1; |
733 for (UserList::const_iterator it = users.begin(); it != users.end(); ++it) { | 734 for (UserList::const_iterator it = users.begin(); it != users.end(); ++it) { |
734 const std::string& email = (*it)->email(); | 735 const std::string& email = (*it)->email(); |
735 std::string owner; | 736 std::string owner; |
736 chromeos::CrosSettings::Get()->GetString(chromeos::kDeviceOwner, &owner); | 737 chromeos::CrosSettings::Get()->GetString(chromeos::kDeviceOwner, &owner); |
737 bool is_owner = (email == owner); | 738 bool is_owner = (email == owner); |
739 bool public_account = ((*it)->GetType() == User::USER_TYPE_PUBLIC_ACCOUNT); | |
738 bool signed_in = *it == UserManager::Get()->GetLoggedInUser(); | 740 bool signed_in = *it == UserManager::Get()->GetLoggedInUser(); |
739 | 741 |
740 if (non_owner_count < max_non_owner_users || is_owner) { | 742 if (non_owner_count < max_non_owner_users || is_owner) { |
741 DictionaryValue* user_dict = new DictionaryValue(); | 743 DictionaryValue* user_dict = new DictionaryValue(); |
742 user_dict->SetString(kKeyUsername, email); | 744 user_dict->SetString(kKeyUsername, email); |
743 user_dict->SetString(kKeyEmailAddress, (*it)->display_email()); | 745 user_dict->SetString(kKeyEmailAddress, (*it)->display_email()); |
744 user_dict->SetString(kKeyDisplayName, (*it)->GetDisplayName()); | 746 user_dict->SetString(kKeyDisplayName, (*it)->GetDisplayName()); |
745 user_dict->SetString(kKeyNameTooltip, (*it)->display_email()); | 747 user_dict->SetString(kKeyNameTooltip, (*it)->display_email()); |
748 user_dict->SetBoolean(kKeyPublicAccount, public_account); | |
746 user_dict->SetInteger(kKeyOauthTokenStatus, (*it)->oauth_token_status()); | 749 user_dict->SetInteger(kKeyOauthTokenStatus, (*it)->oauth_token_status()); |
747 user_dict->SetBoolean(kKeySignedIn, signed_in); | 750 user_dict->SetBoolean(kKeySignedIn, signed_in); |
748 | 751 |
749 // Single user check here is necessary because owner info might not be | 752 // Single user check here is necessary because owner info might not be |
750 // available when running into login screen on first boot. | 753 // available when running into login screen on first boot. |
751 // See http://crosbug.com/12723 | 754 // See http://crosbug.com/12723 |
752 user_dict->SetBoolean(kKeyCanRemove, | 755 user_dict->SetBoolean(kKeyCanRemove, |
753 !single_user && | 756 !single_user && |
754 !email.empty() && | 757 !email.empty() && |
755 !is_owner && | 758 !is_owner && |
759 !public_account && | |
756 !signed_in); | 760 !signed_in); |
757 | 761 |
758 users_list.Append(user_dict); | 762 users_list.Append(user_dict); |
759 if (!is_owner) | 763 if (!is_owner) |
760 ++non_owner_count; | 764 ++non_owner_count; |
761 } | 765 } |
762 } | 766 } |
763 | 767 |
764 base::FundamentalValue animated_value(animated); | 768 base::FundamentalValue animated_value(animated); |
765 base::FundamentalValue guest_value(delegate_->IsShowGuest()); | 769 base::FundamentalValue guest_value(delegate_->IsShowGuest()); |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1000 ConnectionType last_network_type) { | 1004 ConnectionType last_network_type) { |
1001 base::FundamentalValue state_value(state); | 1005 base::FundamentalValue state_value(state); |
1002 base::StringValue network_value(network_name); | 1006 base::StringValue network_value(network_name); |
1003 base::StringValue reason_value(reason); | 1007 base::StringValue reason_value(reason); |
1004 base::FundamentalValue last_network_value(last_network_type); | 1008 base::FundamentalValue last_network_value(last_network_type); |
1005 web_ui()->CallJavascriptFunction(callback, | 1009 web_ui()->CallJavascriptFunction(callback, |
1006 state_value, network_value, reason_value, last_network_value); | 1010 state_value, network_value, reason_value, last_network_value); |
1007 } | 1011 } |
1008 | 1012 |
1009 } // namespace chromeos | 1013 } // namespace chromeos |
OLD | NEW |