| 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" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "chrome/browser/chromeos/contacts/contact.pb.h" | 12 #include "chrome/browser/chromeos/contacts/contact.pb.h" |
| 13 #include "chrome/browser/chromeos/contacts/contact_database.h" | 13 #include "chrome/browser/chromeos/contacts/contact_database.h" |
| 14 #include "chrome/browser/chromeos/contacts/contact_store_observer.h" | 14 #include "chrome/browser/chromeos/contacts/contact_store_observer.h" |
| 15 #include "chrome/browser/chromeos/gdata/drive_system_service.h" |
| 15 #include "chrome/browser/chromeos/gdata/gdata_contacts_service.h" | 16 #include "chrome/browser/chromeos/gdata/gdata_contacts_service.h" |
| 16 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" | |
| 17 #include "chrome/browser/chromeos/gdata/gdata_util.h" | 17 #include "chrome/browser/chromeos/gdata/gdata_util.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 19 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
| 20 | 20 |
| 21 using content::BrowserThread; | 21 using content::BrowserThread; |
| 22 | 22 |
| 23 namespace contacts { | 23 namespace contacts { |
| 24 | 24 |
| 25 namespace { | 25 namespace { |
| 26 | 26 |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 VLOG(1) << "Downloading all contacts for " << profile_->GetProfileName(); | 198 VLOG(1) << "Downloading all contacts for " << profile_->GetProfileName(); |
| 199 } else { | 199 } else { |
| 200 VLOG(1) << "Downloading contacts updated since " | 200 VLOG(1) << "Downloading contacts updated since " |
| 201 << gdata::util::FormatTimeAsString(min_update_time) << " for " | 201 << gdata::util::FormatTimeAsString(min_update_time) << " for " |
| 202 << profile_->GetProfileName(); | 202 << profile_->GetProfileName(); |
| 203 } | 203 } |
| 204 | 204 |
| 205 gdata::GDataContactsServiceInterface* service = | 205 gdata::GDataContactsServiceInterface* service = |
| 206 gdata_service_for_testing_.get() ? | 206 gdata_service_for_testing_.get() ? |
| 207 gdata_service_for_testing_.get() : | 207 gdata_service_for_testing_.get() : |
| 208 gdata::GDataSystemServiceFactory::GetForProfile(profile_)-> | 208 gdata::DriveSystemServiceFactory::GetForProfile(profile_)-> |
| 209 contacts_service(); | 209 contacts_service(); |
| 210 DCHECK(service); | 210 DCHECK(service); |
| 211 service->DownloadContacts( | 211 service->DownloadContacts( |
| 212 base::Bind(&GoogleContactStore::OnDownloadSuccess, | 212 base::Bind(&GoogleContactStore::OnDownloadSuccess, |
| 213 weak_ptr_factory_.GetWeakPtr(), | 213 weak_ptr_factory_.GetWeakPtr(), |
| 214 min_update_time.is_null(), | 214 min_update_time.is_null(), |
| 215 GetCurrentTime()), | 215 GetCurrentTime()), |
| 216 base::Bind(&GoogleContactStore::OnDownloadFailure, | 216 base::Bind(&GoogleContactStore::OnDownloadFailure, |
| 217 weak_ptr_factory_.GetWeakPtr()), | 217 weak_ptr_factory_.GetWeakPtr()), |
| 218 min_update_time); | 218 min_update_time); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 return gdata::util::IsGDataAvailable(profile); | 400 return gdata::util::IsGDataAvailable(profile); |
| 401 } | 401 } |
| 402 | 402 |
| 403 ContactStore* GoogleContactStoreFactory::CreateContactStore(Profile* profile) { | 403 ContactStore* GoogleContactStoreFactory::CreateContactStore(Profile* profile) { |
| 404 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 404 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 405 DCHECK(CanCreateContactStoreForProfile(profile)); | 405 DCHECK(CanCreateContactStoreForProfile(profile)); |
| 406 return new GoogleContactStore(profile); | 406 return new GoogleContactStore(profile); |
| 407 } | 407 } |
| 408 | 408 |
| 409 } // namespace contacts | 409 } // namespace contacts |
| OLD | NEW |