OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #if defined(BROWSER_SYNC) | |
6 #include "chrome/browser/sync/profile_sync_service.h" | 5 #include "chrome/browser/sync/profile_sync_service.h" |
7 | 6 |
8 #include <stack> | 7 #include <stack> |
9 #include <vector> | 8 #include <vector> |
10 | 9 |
11 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
12 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
13 #include "base/command_line.h" | 12 #include "base/command_line.h" |
14 #include "base/file_path.h" | 13 #include "base/file_path.h" |
15 #include "base/file_util.h" | 14 #include "base/file_util.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 profile_->GetPrefs()->SetInt64(prefs::kSyncLastSyncedTime, | 204 profile_->GetPrefs()->SetInt64(prefs::kSyncLastSyncedTime, |
206 last_synced_time_.ToInternalValue()); | 205 last_synced_time_.ToInternalValue()); |
207 profile_->GetPrefs()->ScheduleSavePersistentPrefs(); | 206 profile_->GetPrefs()->ScheduleSavePersistentPrefs(); |
208 } | 207 } |
209 | 208 |
210 // An invariant has been violated. Transition to an error state where we try | 209 // An invariant has been violated. Transition to an error state where we try |
211 // to do as little work as possible, to avoid further corruption or crashes. | 210 // to do as little work as possible, to avoid further corruption or crashes. |
212 void ProfileSyncService::OnUnrecoverableError() { | 211 void ProfileSyncService::OnUnrecoverableError() { |
213 unrecoverable_error_detected_ = true; | 212 unrecoverable_error_detected_ = true; |
214 change_processor_->Stop(); | 213 change_processor_->Stop(); |
215 | 214 |
216 // Tell the wizard so it can inform the user only if it is already open. | 215 // Tell the wizard so it can inform the user only if it is already open. |
217 wizard_.Step(SyncSetupWizard::FATAL_ERROR); | 216 wizard_.Step(SyncSetupWizard::FATAL_ERROR); |
218 FOR_EACH_OBSERVER(Observer, observers_, OnStateChanged()); | 217 FOR_EACH_OBSERVER(Observer, observers_, OnStateChanged()); |
219 LOG(ERROR) << "Unrecoverable error detected -- ProfileSyncService unusable."; | 218 LOG(ERROR) << "Unrecoverable error detected -- ProfileSyncService unusable."; |
220 } | 219 } |
221 | 220 |
222 void ProfileSyncService::OnBackendInitialized() { | 221 void ProfileSyncService::OnBackendInitialized() { |
223 backend_initialized_ = true; | 222 backend_initialized_ = true; |
224 StartProcessingChangesIfReady(); | 223 StartProcessingChangesIfReady(); |
225 | 224 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 histogram.SetFlags(kUmaTargetedHistogramFlag); | 419 histogram.SetFlags(kUmaTargetedHistogramFlag); |
421 histogram.Add(code); | 420 histogram.Add(code); |
422 } | 421 } |
423 | 422 |
424 bool ProfileSyncService::ShouldPushChanges() { | 423 bool ProfileSyncService::ShouldPushChanges() { |
425 // True only after all bootstrapping has succeeded: the bookmark model is | 424 // True only after all bootstrapping has succeeded: the bookmark model is |
426 // loaded, the sync backend is initialized, the two domains are | 425 // loaded, the sync backend is initialized, the two domains are |
427 // consistent with one another, and no unrecoverable error has transpired. | 426 // consistent with one another, and no unrecoverable error has transpired. |
428 return change_processor_->IsRunning(); | 427 return change_processor_->IsRunning(); |
429 } | 428 } |
430 | |
431 #endif // defined(BROWSER_SYNC) | |
OLD | NEW |