| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/easy_unlock/bootstrap_manager.h" | 5 #include "chrome/browser/chromeos/login/easy_unlock/bootstrap_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/chromeos/login/users/chrome_user_manager_impl.h" | 10 #include "chrome/browser/chromeos/login/users/chrome_user_manager_impl.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 void BootstrapManager::RemoveAllPendingBootstrap() { | 59 void BootstrapManager::RemoveAllPendingBootstrap() { |
| 60 PrefService* local_state = g_browser_process->local_state(); | 60 PrefService* local_state = g_browser_process->local_state(); |
| 61 | 61 |
| 62 const base::ListValue* users = | 62 const base::ListValue* users = |
| 63 local_state->GetList(kPendingEasyBootstrapUsers); | 63 local_state->GetList(kPendingEasyBootstrapUsers); |
| 64 for (size_t i = 0; i < users->GetSize(); ++i) { | 64 for (size_t i = 0; i < users->GetSize(); ++i) { |
| 65 std::string current_user_email; | 65 std::string current_user_email; |
| 66 if (users->GetString(i, ¤t_user_email)) { | 66 if (users->GetString(i, ¤t_user_email)) { |
| 67 delegate_->RemovePendingBootstrapUser( | 67 delegate_->RemovePendingBootstrapUser( |
| 68 user_manager::known_user::GetAccountId(current_user_email, | 68 user_manager::known_user::GetAccountId( |
| 69 std::string() /* gaia_id */)); | 69 current_user_email, std::string() /* gaia_id */, |
| 70 std::string() /* account_type */)); |
| 70 } | 71 } |
| 71 } | 72 } |
| 72 | 73 |
| 73 local_state->ClearPref(kPendingEasyBootstrapUsers); | 74 local_state->ClearPref(kPendingEasyBootstrapUsers); |
| 74 local_state->CommitPendingWrite(); | 75 local_state->CommitPendingWrite(); |
| 75 } | 76 } |
| 76 | 77 |
| 77 bool BootstrapManager::HasPendingBootstrap(const AccountId& account_id) const { | 78 bool BootstrapManager::HasPendingBootstrap(const AccountId& account_id) const { |
| 78 PrefService* local_state = g_browser_process->local_state(); | 79 PrefService* local_state = g_browser_process->local_state(); |
| 79 | 80 |
| 80 const base::ListValue* users = | 81 const base::ListValue* users = |
| 81 local_state->GetList(kPendingEasyBootstrapUsers); | 82 local_state->GetList(kPendingEasyBootstrapUsers); |
| 82 for (size_t i = 0; i < users->GetSize(); ++i) { | 83 for (size_t i = 0; i < users->GetSize(); ++i) { |
| 83 std::string current_user; | 84 std::string current_user; |
| 84 if (users->GetString(i, ¤t_user) && | 85 if (users->GetString(i, ¤t_user) && |
| 85 account_id.GetUserEmail() == current_user) | 86 account_id.GetUserEmail() == current_user) |
| 86 return true; | 87 return true; |
| 87 } | 88 } |
| 88 return false; | 89 return false; |
| 89 } | 90 } |
| 90 | 91 |
| 91 } // namespace chromeos | 92 } // namespace chromeos |
| OLD | NEW |