| 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/supervised_user_password_servi
ce.h" | 5 #include "chrome/browser/supervised_user/chromeos/supervised_user_password_servi
ce.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticatio
n.h" | 9 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticatio
n.h" |
| 10 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" | 10 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 supervised_users::kChromeOSPasswordData); | 37 supervised_users::kChromeOSPasswordData); |
| 38 } | 38 } |
| 39 | 39 |
| 40 void SupervisedUserPasswordService::OnSharedSettingsChange( | 40 void SupervisedUserPasswordService::OnSharedSettingsChange( |
| 41 const std::string& su_id, | 41 const std::string& su_id, |
| 42 const std::string& key) { | 42 const std::string& key) { |
| 43 if (key != supervised_users::kChromeOSPasswordData) | 43 if (key != supervised_users::kChromeOSPasswordData) |
| 44 return; | 44 return; |
| 45 chromeos::SupervisedUserManager* supervised_user_manager = | 45 chromeos::SupervisedUserManager* supervised_user_manager = |
| 46 chromeos::UserManager::Get()->GetSupervisedUserManager(); | 46 chromeos::UserManager::Get()->GetSupervisedUserManager(); |
| 47 const chromeos::User* user = supervised_user_manager->FindBySyncId(su_id); | 47 const user_manager::User* user = supervised_user_manager->FindBySyncId(su_id); |
| 48 if (user == NULL) { | 48 if (user == NULL) { |
| 49 LOG(WARNING) << "Got notification for user not on device."; | 49 LOG(WARNING) << "Got notification for user not on device."; |
| 50 return; | 50 return; |
| 51 } | 51 } |
| 52 DCHECK(user_id_ == user->email()); | 52 DCHECK(user_id_ == user->email()); |
| 53 if (user_id_ != user->email()) | 53 if (user_id_ != user->email()) |
| 54 return; | 54 return; |
| 55 const base::Value* value = settings_service_->GetValue(su_id, key); | 55 const base::Value* value = settings_service_->GetValue(su_id, key); |
| 56 if (value == NULL) { | 56 if (value == NULL) { |
| 57 LOG(WARNING) << "Got empty value from sync."; | 57 LOG(WARNING) << "Got empty value from sync."; |
| 58 return; | 58 return; |
| 59 } | 59 } |
| 60 const base::DictionaryValue* dict; | 60 const base::DictionaryValue* dict; |
| 61 if (!value->GetAsDictionary(&dict)) { | 61 if (!value->GetAsDictionary(&dict)) { |
| 62 LOG(WARNING) << "Got non-dictionary value from sync."; | 62 LOG(WARNING) << "Got non-dictionary value from sync."; |
| 63 return; | 63 return; |
| 64 } | 64 } |
| 65 chromeos::SupervisedUserAuthentication* auth = | 65 chromeos::SupervisedUserAuthentication* auth = |
| 66 supervised_user_manager->GetAuthentication(); | 66 supervised_user_manager->GetAuthentication(); |
| 67 if (!auth->NeedPasswordChange(user_id_, dict)) | 67 if (!auth->NeedPasswordChange(user_id_, dict)) |
| 68 return; | 68 return; |
| 69 auth->ScheduleSupervisedPasswordChange(user_id_, dict); | 69 auth->ScheduleSupervisedPasswordChange(user_id_, dict); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void SupervisedUserPasswordService::Shutdown() { | 72 void SupervisedUserPasswordService::Shutdown() { |
| 73 settings_service_subscription_.reset(); | 73 settings_service_subscription_.reset(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 } // namespace chromeos | 76 } // namespace chromeos |
| OLD | NEW |