| 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"; | |
| 72 const char kKeySignedIn[] = "signedIn"; | 71 const char kKeySignedIn[] = "signedIn"; |
| 73 const char kKeyCanRemove[] = "canRemove"; | 72 const char kKeyCanRemove[] = "canRemove"; |
| 74 const char kKeyOauthTokenStatus[] = "oauthTokenStatus"; | 73 const char kKeyOauthTokenStatus[] = "oauthTokenStatus"; |
| 75 | 74 |
| 76 // Max number of users to show. | 75 // Max number of users to show. |
| 77 const size_t kMaxUsers = 5; | 76 const size_t kMaxUsers = 5; |
| 78 | 77 |
| 79 // The Task posted to PostTaskAndReply in StartClearingDnsCache on the IO | 78 // The Task posted to PostTaskAndReply in StartClearingDnsCache on the IO |
| 80 // thread. | 79 // thread. |
| 81 void ClearDnsCache(IOThread* io_thread) { | 80 void ClearDnsCache(IOThread* io_thread) { |
| (...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 | 728 |
| 730 ListValue users_list; | 729 ListValue users_list; |
| 731 const UserList& users = delegate_->GetUsers(); | 730 const UserList& users = delegate_->GetUsers(); |
| 732 | 731 |
| 733 bool single_user = users.size() == 1; | 732 bool single_user = users.size() == 1; |
| 734 for (UserList::const_iterator it = users.begin(); it != users.end(); ++it) { | 733 for (UserList::const_iterator it = users.begin(); it != users.end(); ++it) { |
| 735 const std::string& email = (*it)->email(); | 734 const std::string& email = (*it)->email(); |
| 736 std::string owner; | 735 std::string owner; |
| 737 chromeos::CrosSettings::Get()->GetString(chromeos::kDeviceOwner, &owner); | 736 chromeos::CrosSettings::Get()->GetString(chromeos::kDeviceOwner, &owner); |
| 738 bool is_owner = (email == owner); | 737 bool is_owner = (email == owner); |
| 739 bool public_account = ((*it)->GetType() == User::USER_TYPE_PUBLIC_ACCOUNT); | |
| 740 bool signed_in = *it == UserManager::Get()->GetLoggedInUser(); | 738 bool signed_in = *it == UserManager::Get()->GetLoggedInUser(); |
| 741 | 739 |
| 742 if (non_owner_count < max_non_owner_users || is_owner) { | 740 if (non_owner_count < max_non_owner_users || is_owner) { |
| 743 DictionaryValue* user_dict = new DictionaryValue(); | 741 DictionaryValue* user_dict = new DictionaryValue(); |
| 744 user_dict->SetString(kKeyUsername, email); | 742 user_dict->SetString(kKeyUsername, email); |
| 745 user_dict->SetString(kKeyEmailAddress, (*it)->display_email()); | 743 user_dict->SetString(kKeyEmailAddress, (*it)->display_email()); |
| 746 user_dict->SetString(kKeyDisplayName, (*it)->GetDisplayName()); | 744 user_dict->SetString(kKeyDisplayName, (*it)->GetDisplayName()); |
| 747 user_dict->SetString(kKeyNameTooltip, (*it)->display_email()); | 745 user_dict->SetString(kKeyNameTooltip, (*it)->display_email()); |
| 748 user_dict->SetBoolean(kKeyPublicAccount, public_account); | |
| 749 user_dict->SetInteger(kKeyOauthTokenStatus, (*it)->oauth_token_status()); | 746 user_dict->SetInteger(kKeyOauthTokenStatus, (*it)->oauth_token_status()); |
| 750 user_dict->SetBoolean(kKeySignedIn, signed_in); | 747 user_dict->SetBoolean(kKeySignedIn, signed_in); |
| 751 | 748 |
| 752 // Single user check here is necessary because owner info might not be | 749 // Single user check here is necessary because owner info might not be |
| 753 // available when running into login screen on first boot. | 750 // available when running into login screen on first boot. |
| 754 // See http://crosbug.com/12723 | 751 // See http://crosbug.com/12723 |
| 755 user_dict->SetBoolean(kKeyCanRemove, | 752 user_dict->SetBoolean(kKeyCanRemove, |
| 756 !single_user && | 753 !single_user && |
| 757 !email.empty() && | 754 !email.empty() && |
| 758 !is_owner && | 755 !is_owner && |
| 759 !public_account && | |
| 760 !signed_in); | 756 !signed_in); |
| 761 | 757 |
| 762 users_list.Append(user_dict); | 758 users_list.Append(user_dict); |
| 763 if (!is_owner) | 759 if (!is_owner) |
| 764 ++non_owner_count; | 760 ++non_owner_count; |
| 765 } | 761 } |
| 766 } | 762 } |
| 767 | 763 |
| 768 base::FundamentalValue animated_value(animated); | 764 base::FundamentalValue animated_value(animated); |
| 769 base::FundamentalValue guest_value(delegate_->IsShowGuest()); | 765 base::FundamentalValue guest_value(delegate_->IsShowGuest()); |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1004 ConnectionType last_network_type) { | 1000 ConnectionType last_network_type) { |
| 1005 base::FundamentalValue state_value(state); | 1001 base::FundamentalValue state_value(state); |
| 1006 base::StringValue network_value(network_name); | 1002 base::StringValue network_value(network_name); |
| 1007 base::StringValue reason_value(reason); | 1003 base::StringValue reason_value(reason); |
| 1008 base::FundamentalValue last_network_value(last_network_type); | 1004 base::FundamentalValue last_network_value(last_network_type); |
| 1009 web_ui()->CallJavascriptFunction(callback, | 1005 web_ui()->CallJavascriptFunction(callback, |
| 1010 state_value, network_value, reason_value, last_network_value); | 1006 state_value, network_value, reason_value, last_network_value); |
| 1011 } | 1007 } |
| 1012 | 1008 |
| 1013 } // namespace chromeos | 1009 } // namespace chromeos |
| OLD | NEW |