OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/contacts/fake_contact_database.h" | 5 #include "chrome/browser/chromeos/contacts/fake_contact_database.h" |
6 | 6 |
7 #include "chrome/browser/chromeos/contacts/contact.pb.h" | 7 #include "chrome/browser/chromeos/contacts/contact.pb.h" |
8 #include "chrome/browser/chromeos/contacts/contact_test_util.h" | 8 #include "chrome/browser/chromeos/contacts/contact_test_util.h" |
9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
10 | 10 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 void FakeContactDatabase::MergeContacts( | 70 void FakeContactDatabase::MergeContacts( |
71 const ContactPointers& updated_contacts) { | 71 const ContactPointers& updated_contacts) { |
72 for (ContactPointers::const_iterator updated_it = updated_contacts.begin(); | 72 for (ContactPointers::const_iterator updated_it = updated_contacts.begin(); |
73 updated_it != updated_contacts.end(); ++updated_it) { | 73 updated_it != updated_contacts.end(); ++updated_it) { |
74 const Contact& updated_contact = **updated_it; | 74 const Contact& updated_contact = **updated_it; |
75 bool found = false; | 75 bool found = false; |
76 for (ScopedVector<Contact>::const_iterator existing_it = contacts_.begin(); | 76 for (ScopedVector<Contact>::const_iterator existing_it = contacts_.begin(); |
77 existing_it != contacts_.end(); ++existing_it) { | 77 existing_it != contacts_.end(); ++existing_it) { |
78 Contact* existing_contact = *existing_it; | 78 Contact* existing_contact = *existing_it; |
79 if (existing_contact->provider_id() == updated_contact.provider_id()) { | 79 if (existing_contact->contact_id() == updated_contact.contact_id()) { |
80 *existing_contact = updated_contact; | 80 *existing_contact = updated_contact; |
81 found = true; | 81 found = true; |
82 break; | 82 break; |
83 } | 83 } |
84 } | 84 } |
85 if (!found) | 85 if (!found) |
86 contacts_.push_back(new Contact(updated_contact)); | 86 contacts_.push_back(new Contact(updated_contact)); |
87 } | 87 } |
88 } | 88 } |
89 | 89 |
90 } // namespace contacts | 90 } // namespace contacts |
OLD | NEW |