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 27 matching lines...) Expand all Loading... |
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 const user_manager::UserList& users = |
46 user_manager::UserManager::Get()->GetUsers(); | 46 user_manager::UserManager::Get()->GetUsers(); |
47 | 47 |
48 for (user_manager::UserList::const_iterator it = users.begin(); | 48 for (const auto* user : users) { |
49 it != users.end(); | 49 if (user->GetType() != user_manager::USER_TYPE_SUPERVISED) |
50 ++it) { | |
51 if ((*it)->GetType() != user_manager::USER_TYPE_SUPERVISED) | |
52 continue; | 50 continue; |
53 if (user_id != supervised_user_manager->GetManagerUserId((*it)->email())) | 51 if (user_id != supervised_user_manager->GetManagerUserId(user->email())) |
54 continue; | 52 continue; |
55 OnSharedSettingsChange( | 53 OnSharedSettingsChange( |
56 supervised_user_manager->GetUserSyncId((*it)->email()), | 54 supervised_user_manager->GetUserSyncId(user->email()), |
57 supervised_users::kChromeOSPasswordData); | 55 supervised_users::kChromeOSPasswordData); |
58 } | 56 } |
59 } | 57 } |
60 | 58 |
61 void ManagerPasswordService::OnSharedSettingsChange( | 59 void ManagerPasswordService::OnSharedSettingsChange( |
62 const std::string& su_id, | 60 const std::string& su_id, |
63 const std::string& key) { | 61 const std::string& key) { |
64 if (key != supervised_users::kChromeOSPasswordData) | 62 if (key != supervised_users::kChromeOSPasswordData) |
65 return; | 63 return; |
66 | 64 |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 void ManagerPasswordService::OnOldManagerKeyDeleted( | 266 void ManagerPasswordService::OnOldManagerKeyDeleted( |
269 const UserContext& master_key_context) { | 267 const UserContext& master_key_context) { |
270 VLOG(1) << "Removed old master key for " << master_key_context.GetUserID(); | 268 VLOG(1) << "Removed old master key for " << master_key_context.GetUserID(); |
271 } | 269 } |
272 | 270 |
273 void ManagerPasswordService::Shutdown() { | 271 void ManagerPasswordService::Shutdown() { |
274 settings_service_subscription_.reset(); | 272 settings_service_subscription_.reset(); |
275 } | 273 } |
276 | 274 |
277 } // namespace chromeos | 275 } // namespace chromeos |
OLD | NEW |