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

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

Issue 10882017: contacts: Make GoogleContactStore own GDataContactsService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/contacts/google_contact_store.cc
diff --git a/chrome/browser/chromeos/contacts/google_contact_store.cc b/chrome/browser/chromeos/contacts/google_contact_store.cc
index 6537a50115164366c79786fbde6320bb17d255af..541c04908031426ea30ba4773db99f4935f5b6d2 100644
--- a/chrome/browser/chromeos/contacts/google_contact_store.cc
+++ b/chrome/browser/chromeos/contacts/google_contact_store.cc
@@ -13,7 +13,6 @@
#include "chrome/browser/chromeos/contacts/contact_database.h"
#include "chrome/browser/chromeos/contacts/contact_store_observer.h"
#include "chrome/browser/chromeos/gdata/gdata_contacts_service.h"
-#include "chrome/browser/chromeos/gdata/gdata_system_service.h"
#include "chrome/browser/chromeos/gdata/gdata_util.h"
#include "chrome/browser/profiles/profile.h"
#include "content/public/browser/browser_thread.h"
@@ -67,7 +66,7 @@ void GoogleContactStore::TestAPI::SetDatabase(ContactDatabaseInterface* db) {
void GoogleContactStore::TestAPI::SetGDataService(
gdata::GDataContactsServiceInterface* service) {
- store_->gdata_service_for_testing_.reset(service);
+ store_->gdata_service_.reset(service);
}
void GoogleContactStore::TestAPI::DoUpdate() {
@@ -105,6 +104,13 @@ GoogleContactStore::~GoogleContactStore() {
void GoogleContactStore::Init() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ // Create a GData service if one hasn't already been assigned for testing.
+ if (!gdata_service_.get()) {
+ gdata_service_.reset(new gdata::GDataContactsService(profile_));
+ gdata_service_->Initialize();
+ }
+
FilePath db_path = profile_->GetPath().Append(kDatabaseDirectoryName);
VLOG(1) << "Initializing contact database \"" << db_path.value() << "\" for "
<< profile_->GetProfileName();
@@ -202,13 +208,7 @@ void GoogleContactStore::UpdateContacts() {
<< profile_->GetProfileName();
}
- gdata::GDataContactsServiceInterface* service =
- gdata_service_for_testing_.get() ?
- gdata_service_for_testing_.get() :
- gdata::GDataSystemServiceFactory::GetForProfile(profile_)->
- contacts_service();
- DCHECK(service);
- service->DownloadContacts(
+ gdata_service_->DownloadContacts(
base::Bind(&GoogleContactStore::OnDownloadSuccess,
weak_ptr_factory_.GetWeakPtr(),
min_update_time.is_null(),

Powered by Google App Engine
This is Rietveld 408576698