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_reconcilor.h" | 5 #include "components/signin/core/browser/account_reconcilor.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 merge_session_helper_.SignalComplete( | 654 merge_session_helper_.SignalComplete( |
655 add_to_cookie_copy[i], | 655 add_to_cookie_copy[i], |
656 GoogleServiceAuthError::AuthErrorNone()); | 656 GoogleServiceAuthError::AuthErrorNone()); |
657 } else { | 657 } else { |
658 PerformMergeAction(add_to_cookie_copy[i]); | 658 PerformMergeAction(add_to_cookie_copy[i]); |
659 added_to_cookie++; | 659 added_to_cookie++; |
660 } | 660 } |
661 } | 661 } |
662 | 662 |
663 // For each account in the gaia cookie not known to chrome, | 663 // For each account in the gaia cookie not known to chrome, |
664 // PerformAddToChromeAction. | 664 // PerformAddToChromeAction. Make a copy of |add_to_chrome| since calls to |
| 665 // PerformAddToChromeAction() may modify this array. |
| 666 std::vector<std::pair<std::string, int> > add_to_chrome_copy = add_to_chrome_; |
665 for (std::vector<std::pair<std::string, int> >::const_iterator i = | 667 for (std::vector<std::pair<std::string, int> >::const_iterator i = |
666 add_to_chrome_.begin(); | 668 add_to_chrome_copy.begin(); |
667 i != add_to_chrome_.end(); | 669 i != add_to_chrome_copy.end(); |
668 ++i) { | 670 ++i) { |
669 PerformAddToChromeAction(i->first, i->second); | 671 PerformAddToChromeAction(i->first, i->second); |
670 } | 672 } |
671 | 673 |
672 signin_metrics::LogSigninAccountReconciliation(valid_chrome_accounts_.size(), | 674 signin_metrics::LogSigninAccountReconciliation(valid_chrome_accounts_.size(), |
673 added_to_cookie, | 675 added_to_cookie, |
674 add_to_chrome_.size(), | 676 add_to_chrome_.size(), |
675 are_primaries_equal, | 677 are_primaries_equal, |
676 first_execution_); | 678 first_execution_); |
677 first_execution_ = false; | 679 first_execution_ = false; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 | 774 |
773 void AccountReconcilor::HandleRefreshTokenFetched( | 775 void AccountReconcilor::HandleRefreshTokenFetched( |
774 const std::string& account_id, | 776 const std::string& account_id, |
775 const std::string& refresh_token) { | 777 const std::string& refresh_token) { |
776 if (!refresh_token.empty()) | 778 if (!refresh_token.empty()) |
777 PerformAddAccountToTokenService(account_id, refresh_token); | 779 PerformAddAccountToTokenService(account_id, refresh_token); |
778 | 780 |
779 MarkAccountAsAddedToChrome(account_id); | 781 MarkAccountAsAddedToChrome(account_id); |
780 CalculateIfReconcileIsDone(); | 782 CalculateIfReconcileIsDone(); |
781 } | 783 } |
OLD | NEW |