| 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 "components/signin/core/browser/account_tracker_service.h" | 5 #include "components/signin/core/browser/account_tracker_service.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 for (std::map<std::string, AccountState>::const_iterator it = | 301 for (std::map<std::string, AccountState>::const_iterator it = |
| 302 migrated_accounts.begin(); | 302 migrated_accounts.begin(); |
| 303 it != migrated_accounts.end(); ++it) { | 303 it != migrated_accounts.end(); ++it) { |
| 304 accounts_.insert(*it); | 304 accounts_.insert(*it); |
| 305 } | 305 } |
| 306 } | 306 } |
| 307 | 307 |
| 308 void AccountTrackerService::LoadFromPrefs() { | 308 void AccountTrackerService::LoadFromPrefs() { |
| 309 const base::ListValue* list = | 309 const base::ListValue* list = |
| 310 signin_client_->GetPrefs()->GetList(kAccountInfoPref); | 310 signin_client_->GetPrefs()->GetList(kAccountInfoPref); |
| 311 if (list == nullptr) |
| 312 return; |
| 311 std::set<std::string> to_remove; | 313 std::set<std::string> to_remove; |
| 312 bool contains_deprecated_service_flags = false; | 314 bool contains_deprecated_service_flags = false; |
| 313 for (size_t i = 0; i < list->GetSize(); ++i) { | 315 for (size_t i = 0; i < list->GetSize(); ++i) { |
| 314 const base::DictionaryValue* dict; | 316 const base::DictionaryValue* dict; |
| 315 if (list->GetDictionary(i, &dict)) { | 317 if (list->GetDictionary(i, &dict)) { |
| 316 base::string16 value; | 318 base::string16 value; |
| 317 if (dict->GetString(kAccountKeyPath, &value)) { | 319 if (dict->GetString(kAccountKeyPath, &value)) { |
| 318 std::string account_id = base::UTF16ToUTF8(value); | 320 std::string account_id = base::UTF16ToUTF8(value); |
| 319 | 321 |
| 320 // Ignore incorrectly persisted non-canonical account ids. | 322 // Ignore incorrectly persisted non-canonical account ids. |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 NotifyAccountUpdated(state); | 503 NotifyAccountUpdated(state); |
| 502 } | 504 } |
| 503 SaveToPrefs(state); | 505 SaveToPrefs(state); |
| 504 } | 506 } |
| 505 return info.account_id; | 507 return info.account_id; |
| 506 } | 508 } |
| 507 | 509 |
| 508 void AccountTrackerService::RemoveAccount(const std::string& account_id) { | 510 void AccountTrackerService::RemoveAccount(const std::string& account_id) { |
| 509 StopTrackingAccount(account_id); | 511 StopTrackingAccount(account_id); |
| 510 } | 512 } |
| OLD | NEW |