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 #include "chrome/browser/sync/profile_sync_service.h" | 5 #include "chrome/browser/sync/profile_sync_service.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 data_type_manager_->Stop(); | 251 data_type_manager_->Stop(); |
252 | 252 |
253 // Tell the wizard so it can inform the user only if it is already open. | 253 // Tell the wizard so it can inform the user only if it is already open. |
254 wizard_.Step(SyncSetupWizard::FATAL_ERROR); | 254 wizard_.Step(SyncSetupWizard::FATAL_ERROR); |
255 FOR_EACH_OBSERVER(Observer, observers_, OnStateChanged()); | 255 FOR_EACH_OBSERVER(Observer, observers_, OnStateChanged()); |
256 LOG(ERROR) << "Unrecoverable error detected -- ProfileSyncService unusable."; | 256 LOG(ERROR) << "Unrecoverable error detected -- ProfileSyncService unusable."; |
257 } | 257 } |
258 | 258 |
259 void ProfileSyncService::OnBackendInitialized() { | 259 void ProfileSyncService::OnBackendInitialized() { |
260 backend_initialized_ = true; | 260 backend_initialized_ = true; |
261 StartProcessingChangesIfReady(); | |
262 | 261 |
263 // The very first time the backend initializes is effectively the first time | 262 // The very first time the backend initializes is effectively the first time |
264 // we can say we successfully "synced". last_synced_time_ will only be null | 263 // we can say we successfully "synced". last_synced_time_ will only be null |
265 // in this case, because the pref wasn't restored on StartUp. | 264 // in this case, because the pref wasn't restored on StartUp. |
266 if (last_synced_time_.is_null()) | 265 if (last_synced_time_.is_null()) |
267 UpdateLastSyncedTime(); | 266 UpdateLastSyncedTime(); |
268 FOR_EACH_OBSERVER(Observer, observers_, OnStateChanged()); | 267 FOR_EACH_OBSERVER(Observer, observers_, OnStateChanged()); |
| 268 |
| 269 StartProcessingChangesIfReady(); |
269 } | 270 } |
270 | 271 |
271 void ProfileSyncService::OnSyncCycleCompleted() { | 272 void ProfileSyncService::OnSyncCycleCompleted() { |
272 UpdateLastSyncedTime(); | 273 UpdateLastSyncedTime(); |
273 FOR_EACH_OBSERVER(Observer, observers_, OnStateChanged()); | 274 FOR_EACH_OBSERVER(Observer, observers_, OnStateChanged()); |
274 } | 275 } |
275 | 276 |
276 void ProfileSyncService::OnAuthError() { | 277 void ProfileSyncService::OnAuthError() { |
277 last_auth_error_ = backend_->GetAuthError(); | 278 last_auth_error_ = backend_->GetAuthError(); |
278 // Protect against the in-your-face dialogs that pop out of nowhere. | 279 // Protect against the in-your-face dialogs that pop out of nowhere. |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 // is initialized, all enabled data types are consistent with one | 454 // is initialized, all enabled data types are consistent with one |
454 // another, and no unrecoverable error has transpired. | 455 // another, and no unrecoverable error has transpired. |
455 if (unrecoverable_error_detected_) | 456 if (unrecoverable_error_detected_) |
456 return false; | 457 return false; |
457 | 458 |
458 if (!data_type_manager_.get()) | 459 if (!data_type_manager_.get()) |
459 return false; | 460 return false; |
460 | 461 |
461 return data_type_manager_->state() == DataTypeManager::STARTED; | 462 return data_type_manager_->state() == DataTypeManager::STARTED; |
462 } | 463 } |
OLD | NEW |