Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(324)

Side by Side Diff: chrome/browser/chromeos/contacts/contact_test_util.cc

Issue 10829144: contacts: Add GoogleContactStore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix leaked contacts in GoogleContactStore::MergeContacts() Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/contact_test_util.h" 5 #include "chrome/browser/chromeos/contacts/contact_test_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 for (int i = 0; i < num_contacts; ++i) 131 for (int i = 0; i < num_contacts; ++i)
132 contacts.push_back(va_arg(list, const Contact*)); 132 contacts.push_back(va_arg(list, const Contact*));
133 va_end(list); 133 va_end(list);
134 return ContactsToString(contacts); 134 return ContactsToString(contacts);
135 } 135 }
136 136
137 void CopyContacts(const ContactPointers& source, 137 void CopyContacts(const ContactPointers& source,
138 ScopedVector<Contact>* dest) { 138 ScopedVector<Contact>* dest) {
139 DCHECK(dest); 139 DCHECK(dest);
140 dest->clear(); 140 dest->clear();
141 for (size_t i = 0; i < source.size(); ++i) { 141 for (size_t i = 0; i < source.size(); ++i)
142 Contact* contact = new Contact; 142 dest->push_back(new Contact(*source[i]));
143 *contact = *source[i];
144 dest->push_back(contact);
145 }
146 } 143 }
147 144
148 void CopyContacts(const ScopedVector<Contact>& source, 145 void CopyContacts(const ScopedVector<Contact>& source,
149 ScopedVector<Contact>* dest) { 146 ScopedVector<Contact>* dest) {
150 ContactPointers pointers; 147 ContactPointers pointers;
151 for (size_t i = 0; i < source.size(); ++i) 148 for (size_t i = 0; i < source.size(); ++i)
152 pointers.push_back(source[i]); 149 pointers.push_back(source[i]);
153 CopyContacts(pointers, dest); 150 CopyContacts(pointers, dest);
154 } 151 }
155 152
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 SkCanvas canvas(bitmap); 236 SkCanvas canvas(bitmap);
240 canvas.clear(SK_ColorBLACK); 237 canvas.clear(SK_ColorBLACK);
241 238
242 std::vector<unsigned char> png_photo; 239 std::vector<unsigned char> png_photo;
243 CHECK(gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &png_photo)); 240 CHECK(gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &png_photo));
244 contact->set_raw_untrusted_photo(&png_photo[0], png_photo.size()); 241 contact->set_raw_untrusted_photo(&png_photo[0], png_photo.size());
245 } 242 }
246 243
247 } // namespace test 244 } // namespace test
248 } // namespace contacts 245 } // namespace contacts
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/contacts/contact_store_observer.h ('k') | chrome/browser/chromeos/contacts/google_contact_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698