| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 : profile_(profile), | 78 : profile_(profile), |
| 79 contacts_deleter_(&contacts_), | 79 contacts_deleter_(&contacts_), |
| 80 db_(new ContactDatabase), | 80 db_(new ContactDatabase), |
| 81 update_delay_on_next_failure_( | 81 update_delay_on_next_failure_( |
| 82 base::TimeDelta::FromSeconds(kUpdateFailureInitialRetrySec)), | 82 base::TimeDelta::FromSeconds(kUpdateFailureInitialRetrySec)), |
| 83 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { | 83 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { |
| 84 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 84 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 85 } | 85 } |
| 86 | 86 |
| 87 GoogleContactStore::~GoogleContactStore() { | 87 GoogleContactStore::~GoogleContactStore() { |
| 88 // This should also be running on the UI thread but we can't check it; the | 88 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 89 // message loop is typically already getting torn down at this point. | |
| 90 weak_ptr_factory_.InvalidateWeakPtrs(); | 89 weak_ptr_factory_.InvalidateWeakPtrs(); |
| 91 DestroyDatabase(); | 90 DestroyDatabase(); |
| 92 } | 91 } |
| 93 | 92 |
| 94 void GoogleContactStore::Init() { | 93 void GoogleContactStore::Init() { |
| 95 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 94 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 96 FilePath db_path = profile_->GetPath().Append(kDatabaseDirectoryName); | 95 FilePath db_path = profile_->GetPath().Append(kDatabaseDirectoryName); |
| 97 VLOG(1) << "Initializing contact database \"" << db_path.value() << "\" for " | 96 VLOG(1) << "Initializing contact database \"" << db_path.value() << "\" for " |
| 98 << profile_->GetProfileName(); | 97 << profile_->GetProfileName(); |
| 99 db_->Init(db_path, | 98 db_->Init(db_path, |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 return gdata::util::IsGDataAvailable(profile); | 368 return gdata::util::IsGDataAvailable(profile); |
| 370 } | 369 } |
| 371 | 370 |
| 372 ContactStore* GoogleContactStoreFactory::CreateContactStore(Profile* profile) { | 371 ContactStore* GoogleContactStoreFactory::CreateContactStore(Profile* profile) { |
| 373 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 372 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 374 DCHECK(CanCreateContactStoreForProfile(profile)); | 373 DCHECK(CanCreateContactStoreForProfile(profile)); |
| 375 return new GoogleContactStore(profile); | 374 return new GoogleContactStore(profile); |
| 376 } | 375 } |
| 377 | 376 |
| 378 } // namespace contacts | 377 } // namespace contacts |
| OLD | NEW |