summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync
diff options
context:
space:
mode:
authornick@chromium.org <nick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-13 17:18:15 +0000
committernick@chromium.org <nick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-13 17:18:15 +0000
commit28ac70d17d634c99a14b6707d88cd8506a5d27f6 (patch)
tree1221413097213e065a73ca5292514c7693dc6f2c /chrome/browser/sync
parent8b50bd202626cf978685197adee0d8f32161443b (diff)
downloadchromium_src-28ac70d17d634c99a14b6707d88cd8506a5d27f6.zip
chromium_src-28ac70d17d634c99a14b6707d88cd8506a5d27f6.tar.gz
chromium_src-28ac70d17d634c99a14b6707d88cd8506a5d27f6.tar.bz2
Defensive checks for backend_ existence.
BUG=3231 (chromium-os) http://code.google.com/p/chromium-os/issues/detail?id=3231 Review URL: http://codereview.chromium.org/2058006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47156 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync')
-rw-r--r--chrome/browser/sync/profile_sync_service.cc31
1 files changed, 28 insertions, 3 deletions
diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc
index e4fb3d4..a3672c0 100644
--- a/chrome/browser/sync/profile_sync_service.cc
+++ b/chrome/browser/sync/profile_sync_service.cc
@@ -203,6 +203,11 @@ std::string ProfileSyncService::GetLsidForAuthBootstraping() {
}
void ProfileSyncService::InitializeBackend(bool delete_sync_data_folder) {
+ if (!backend_.get()) {
+ NOTREACHED();
+ return;
+ }
+
bool invalidate_sync_login = false;
bool invalidate_sync_xmpp_login = false;
#if !defined(NDEBUG)
@@ -429,11 +434,20 @@ void ProfileSyncService::ShowLoginDialog() {
}
SyncBackendHost::StatusSummary ProfileSyncService::QuerySyncStatusSummary() {
- return backend_->GetStatusSummary();
+ if (backend_.get())
+ return backend_->GetStatusSummary();
+ else
+ return SyncBackendHost::Status::OFFLINE_UNUSABLE;
}
SyncBackendHost::Status ProfileSyncService::QueryDetailedSyncStatus() {
- return backend_->GetDetailedStatus();
+ if (backend_.get()) {
+ return backend_->GetDetailedStatus();
+ } else {
+ SyncBackendHost::Status status =
+ { SyncBackendHost::Status::OFFLINE_UNUSABLE };
+ return status;
+ }
}
std::wstring ProfileSyncService::BuildSyncStatusSummaryText(
@@ -470,12 +484,19 @@ std::wstring ProfileSyncService::GetLastSyncedTimeString() const {
}
string16 ProfileSyncService::GetAuthenticatedUsername() const {
- return backend_->GetAuthenticatedUsername();
+ if (backend_.get())
+ return backend_->GetAuthenticatedUsername();
+ else
+ return string16();
}
void ProfileSyncService::OnUserSubmittedAuth(
const std::string& username, const std::string& password,
const std::string& captcha) {
+ if (!backend_.get()) {
+ NOTREACHED();
+ return;
+ }
last_attempted_user_email_ = username;
is_auth_in_progress_ = true;
FOR_EACH_OBSERVER(Observer, observers_, OnStateChanged());
@@ -569,6 +590,10 @@ void ProfileSyncService::StartProcessingChangesIfReady() {
void ProfileSyncService::ActivateDataType(
DataTypeController* data_type_controller,
ChangeProcessor* change_processor) {
+ if (!backend_.get()) {
+ NOTREACHED();
+ return;
+ }
change_processor->Start(profile(), backend_->GetUserShareHandle());
backend_->ActivateDataType(data_type_controller, change_processor);
}