OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/chromeos/login/existing_user_controller.h" | 5 #include "chrome/browser/chromeos/login/existing_user_controller.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/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 void ExistingUserController::Init(const UserList& users) { | 95 void ExistingUserController::Init(const UserList& users) { |
96 UserList filtered_users; | 96 UserList filtered_users; |
97 bool show_users_on_signin; | 97 bool show_users_on_signin; |
98 | 98 |
99 // TODO(pastarmovj): Make this class an observer of the CrosSettings to be | 99 // TODO(pastarmovj): Make this class an observer of the CrosSettings to be |
100 // able to update the UI whenever policy is loaded. | 100 // able to update the UI whenever policy is loaded. |
101 cros_settings_->GetBoolean(kAccountsPrefShowUserNamesOnSignIn, | 101 cros_settings_->GetBoolean(kAccountsPrefShowUserNamesOnSignIn, |
102 &show_users_on_signin); | 102 &show_users_on_signin); |
103 if (show_users_on_signin) { | 103 if (show_users_on_signin) { |
104 bool allow_new_user = false; | 104 bool allow_new_user = false; |
105 const base::ListValue *user_list; | |
106 cros_settings_->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); | 105 cros_settings_->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); |
107 cros_settings_->GetList(kAccountsPrefUsers, &user_list); | |
108 for (UserList::const_iterator it = users.begin(); it != users.end(); ++it) { | 106 for (UserList::const_iterator it = users.begin(); it != users.end(); ++it) { |
109 base::StringValue email((*it)->email()); | |
110 // TODO(xiyuan): Clean user profile whose email is not in whitelist. | 107 // TODO(xiyuan): Clean user profile whose email is not in whitelist. |
111 if (allow_new_user || | 108 if (allow_new_user || |
112 user_list->Find(email) != user_list->end()) { | 109 cros_settings_->FindEmailInList(kAccountsPrefUsers, |
| 110 (*it)->email())) { |
113 filtered_users.push_back(*it); | 111 filtered_users.push_back(*it); |
114 } | 112 } |
115 } | 113 } |
116 } | 114 } |
117 | 115 |
118 // If no user pods are visible, fallback to single new user pod which will | 116 // If no user pods are visible, fallback to single new user pod which will |
119 // have guest session link. | 117 // have guest session link. |
120 bool show_guest; | 118 bool show_guest; |
121 cros_settings_->GetBoolean(kAccountsPrefAllowGuest, &show_guest); | 119 cros_settings_->GetBoolean(kAccountsPrefAllowGuest, &show_guest); |
122 show_guest &= !filtered_users.empty(); | 120 show_guest &= !filtered_users.empty(); |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 std::string owner; | 608 std::string owner; |
611 cros_settings_->GetString(kDeviceOwner, &owner); | 609 cros_settings_->GetString(kDeviceOwner, &owner); |
612 cryptohomed->AsyncSetOwnerUser(owner, NULL); | 610 cryptohomed->AsyncSetOwnerUser(owner, NULL); |
613 | 611 |
614 // Do not invoke AsyncDoAutomaticFreeDiskSpaceControl(NULL) here | 612 // Do not invoke AsyncDoAutomaticFreeDiskSpaceControl(NULL) here |
615 // so it does not delay the following mount. Cleanup will be | 613 // so it does not delay the following mount. Cleanup will be |
616 // started in Cryptohomed by timer. | 614 // started in Cryptohomed by timer. |
617 } | 615 } |
618 | 616 |
619 } // namespace chromeos | 617 } // namespace chromeos |
OLD | NEW |