OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/supervised_user/chromeos/manager_password_service.h" | 5 #include "chrome/browser/supervised_user/chromeos/manager_password_service.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 settings_service_ = shared_settings_service; | 35 settings_service_ = shared_settings_service; |
36 settings_service_subscription_ = settings_service_->Subscribe( | 36 settings_service_subscription_ = settings_service_->Subscribe( |
37 base::Bind(&ManagerPasswordService::OnSharedSettingsChange, | 37 base::Bind(&ManagerPasswordService::OnSharedSettingsChange, |
38 weak_ptr_factory_.GetWeakPtr())); | 38 weak_ptr_factory_.GetWeakPtr())); |
39 | 39 |
40 authenticator_ = new ExtendedAuthenticator(this); | 40 authenticator_ = new ExtendedAuthenticator(this); |
41 | 41 |
42 SupervisedUserManager* supervised_user_manager = | 42 SupervisedUserManager* supervised_user_manager = |
43 ChromeUserManager::Get()->GetSupervisedUserManager(); | 43 ChromeUserManager::Get()->GetSupervisedUserManager(); |
44 | 44 |
45 const user_manager::UserList& users = | 45 for (const user_manager::User* user : |
46 user_manager::UserManager::Get()->GetUsers(); | 46 user_manager::UserManager::Get()->GetUsers()) { |
47 | 47 if (user->GetType() != user_manager::USER_TYPE_SUPERVISED) |
48 for (user_manager::UserList::const_iterator it = users.begin(); | |
49 it != users.end(); | |
50 ++it) { | |
51 if ((*it)->GetType() != user_manager::USER_TYPE_SUPERVISED) | |
52 continue; | 48 continue; |
53 if (user_id != supervised_user_manager->GetManagerUserId((*it)->email())) | 49 if (user_id != supervised_user_manager->GetManagerUserId(user->email())) |
54 continue; | 50 continue; |
55 OnSharedSettingsChange( | 51 OnSharedSettingsChange( |
56 supervised_user_manager->GetUserSyncId((*it)->email()), | 52 supervised_user_manager->GetUserSyncId(user->email()), |
57 supervised_users::kChromeOSPasswordData); | 53 supervised_users::kChromeOSPasswordData); |
58 } | 54 } |
59 } | 55 } |
60 | 56 |
61 void ManagerPasswordService::OnSharedSettingsChange( | 57 void ManagerPasswordService::OnSharedSettingsChange( |
62 const std::string& su_id, | 58 const std::string& su_id, |
63 const std::string& key) { | 59 const std::string& key) { |
64 if (key != supervised_users::kChromeOSPasswordData) | 60 if (key != supervised_users::kChromeOSPasswordData) |
65 return; | 61 return; |
66 | 62 |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 void ManagerPasswordService::OnOldManagerKeyDeleted( | 264 void ManagerPasswordService::OnOldManagerKeyDeleted( |
269 const UserContext& master_key_context) { | 265 const UserContext& master_key_context) { |
270 VLOG(1) << "Removed old master key for " << master_key_context.GetUserID(); | 266 VLOG(1) << "Removed old master key for " << master_key_context.GetUserID(); |
271 } | 267 } |
272 | 268 |
273 void ManagerPasswordService::Shutdown() { | 269 void ManagerPasswordService::Shutdown() { |
274 settings_service_subscription_.reset(); | 270 settings_service_subscription_.reset(); |
275 } | 271 } |
276 | 272 |
277 } // namespace chromeos | 273 } // namespace chromeos |
OLD | NEW |