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

Unified Diff: chrome/browser/chromeos/contacts/fake_contact_database.cc

Issue 10542076: ABANDONED: chromeos: Download contacts (work in progress). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: minor changes Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/contacts/fake_contact_database.cc
diff --git a/chrome/browser/chromeos/contacts/fake_contact_database.cc b/chrome/browser/chromeos/contacts/fake_contact_database.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ff5ccfeb8fd8779c69747f754d1cb45c426758f8
--- /dev/null
+++ b/chrome/browser/chromeos/contacts/fake_contact_database.cc
@@ -0,0 +1,45 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/chromeos/contacts/fake_contact_database.h"
+
+#include "chrome/browser/chromeos/contacts/contact.h"
+#include "chrome/browser/chromeos/contacts/contact_test_lib.h"
+
+namespace contacts {
+
+FakeContactDatabase::FakeContactDatabase()
+ : init_success_(true),
+ save_success_(true),
+ load_success_(true) {
+}
+
+FakeContactDatabase::~FakeContactDatabase() {
+}
+
+void FakeContactDatabase::Init(const FilePath& database_path,
+ InitCallback callback) {
+ callback.Run(init_success_);
+}
+
+void FakeContactDatabase::SetContacts(const ContactPointers& contacts) {
+ test::CopyContacts(contacts, &contacts_);
+}
+
+void FakeContactDatabase::SaveContacts(scoped_ptr<ContactPointers> contacts,
+ bool is_full_update,
+ SaveCallback callback) {
+ if (save_success_)
+ test::CopyContacts(*contacts, &contacts_);
+ callback.Run(save_success_);
+}
+
+void FakeContactDatabase::LoadContacts(LoadCallback callback) {
+ scoped_ptr<ScopedVector<Contact> > contacts(new ScopedVector<Contact>());
+ if (load_success_)
+ test::CopyContacts(contacts_, contacts.get());
+ callback.Run(load_success_, contacts.Pass());
+}
+
+} // namespace contacts
« no previous file with comments | « chrome/browser/chromeos/contacts/fake_contact_database.h ('k') | chrome/browser/chromeos/contacts/google_contact_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698