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/google_contact_store.h" | 5 #include "chrome/browser/chromeos/contacts/google_contact_store.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
266 last_successful_update_start_time_ = update_start_time; | 266 last_successful_update_start_time_ = update_start_time; |
267 | 267 |
268 if (is_full_update || num_updated_contacts > 0) { | 268 if (is_full_update || num_updated_contacts > 0) { |
269 FOR_EACH_OBSERVER(ContactStoreObserver, | 269 FOR_EACH_OBSERVER(ContactStoreObserver, |
270 observers_, | 270 observers_, |
271 OnContactsUpdated(this)); | 271 OnContactsUpdated(this)); |
272 } | 272 } |
273 | 273 |
274 if (db_) { | 274 if (db_) { |
275 scoped_ptr<ContactPointers> contacts_to_save(new ContactPointers); | 275 scoped_ptr<ContactPointers> contacts_to_save(new ContactPointers); |
276 for (ContactMap::const_iterator it = contacts_.begin(); | 276 for (ContactMap::const_iterator it = contacts_.begin(); |
Daniel Erat
2012/08/03 20:00:23
This is an embarrassing bug -- I was writing all c
| |
277 it != contacts_.end(); ++it) { | 277 it != contacts_.end(); ++it) { |
278 contacts_to_save->push_back(it->second); | 278 contacts_to_save->push_back(it->second); |
279 } | 279 } |
280 scoped_ptr<UpdateMetadata> metadata(new UpdateMetadata); | 280 scoped_ptr<UpdateMetadata> metadata(new UpdateMetadata); |
281 metadata->set_last_update_start_time(update_start_time.ToInternalValue()); | 281 metadata->set_last_update_start_time(update_start_time.ToInternalValue()); |
282 | 282 |
283 db_->SaveContacts( | 283 db_->SaveContacts( |
284 contacts_to_save.Pass(), | 284 contacts_to_save.Pass(), |
285 metadata.Pass(), | 285 metadata.Pass(), |
286 is_full_update, | 286 is_full_update, |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
343 void GoogleContactStore::OnDatabaseContactsSaved(bool success) { | 343 void GoogleContactStore::OnDatabaseContactsSaved(bool success) { |
344 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 344 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
345 if (!success) | 345 if (!success) |
346 LOG(WARNING) << "Failed to save contacts to database"; | 346 LOG(WARNING) << "Failed to save contacts to database"; |
347 | 347 |
348 // We only update the database when we've successfully downloaded contacts, so | 348 // We only update the database when we've successfully downloaded contacts, so |
349 // report success to ScheduleUpdate() even if the database update failed. | 349 // report success to ScheduleUpdate() even if the database update failed. |
350 ScheduleUpdate(true); | 350 ScheduleUpdate(true); |
351 } | 351 } |
352 | 352 |
353 GoogleContactStoreFactory::GoogleContactStoreFactory() { | |
354 } | |
355 | |
356 GoogleContactStoreFactory::~GoogleContactStoreFactory() { | |
357 } | |
358 | |
359 ContactStore* GoogleContactStoreFactory::CreateContactStore(Profile* profile) { | |
360 return new GoogleContactStore(profile); | |
361 } | |
362 | |
353 } // namespace contacts | 363 } // namespace contacts |
OLD | NEW |