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/sync/profile_sync_service.h" | 5 #include "chrome/browser/sync/profile_sync_service.h" |
6 | 6 |
7 #include <cstddef> | 7 #include <cstddef> |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 251 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
252 DCHECK(profile); | 252 DCHECK(profile); |
253 startup_controller_.reset(new browser_sync::StartupController( | 253 startup_controller_.reset(new browser_sync::StartupController( |
254 start_behavior, | 254 start_behavior, |
255 oauth2_token_service, | 255 oauth2_token_service, |
256 &sync_prefs_, | 256 &sync_prefs_, |
257 signin_.get(), | 257 signin_.get(), |
258 base::Bind(&ProfileSyncService::StartUpSlowBackendComponents, | 258 base::Bind(&ProfileSyncService::StartUpSlowBackendComponents, |
259 startup_controller_weak_factory_.GetWeakPtr(), | 259 startup_controller_weak_factory_.GetWeakPtr(), |
260 SYNC))); | 260 SYNC))); |
261 backup_rollback_controller_.reset(new browser_sync::BackupRollbackController( | 261 backup_rollback_controller_.reset(new sync_driver::BackupRollbackController( |
262 &sync_prefs_, | 262 &sync_prefs_, |
263 signin_.get(), | 263 signin_.get(), |
264 base::Bind(&ProfileSyncService::StartUpSlowBackendComponents, | 264 base::Bind(&ProfileSyncService::StartUpSlowBackendComponents, |
265 startup_controller_weak_factory_.GetWeakPtr(), | 265 startup_controller_weak_factory_.GetWeakPtr(), |
266 BACKUP), | 266 BACKUP), |
267 base::Bind(&ProfileSyncService::StartUpSlowBackendComponents, | 267 base::Bind(&ProfileSyncService::StartUpSlowBackendComponents, |
268 startup_controller_weak_factory_.GetWeakPtr(), | 268 startup_controller_weak_factory_.GetWeakPtr(), |
269 ROLLBACK))); | 269 ROLLBACK))); |
270 syncer::SyncableService::StartSyncFlare flare( | 270 syncer::SyncableService::StartSyncFlare flare( |
271 sync_start_util::GetFlareForSyncableService(profile->GetPath())); | 271 sync_start_util::GetFlareForSyncableService(profile->GetPath())); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 #endif | 354 #endif |
355 | 355 |
356 #if !defined(OS_ANDROID) | 356 #if !defined(OS_ANDROID) |
357 DCHECK(sync_error_controller_ == NULL) | 357 DCHECK(sync_error_controller_ == NULL) |
358 << "Initialize() called more than once."; | 358 << "Initialize() called more than once."; |
359 sync_error_controller_.reset(new SyncErrorController(this)); | 359 sync_error_controller_.reset(new SyncErrorController(this)); |
360 AddObserver(sync_error_controller_.get()); | 360 AddObserver(sync_error_controller_.get()); |
361 #endif | 361 #endif |
362 | 362 |
363 bool running_rollback = false; | 363 bool running_rollback = false; |
364 if (browser_sync::BackupRollbackController::IsBackupEnabled()) { | 364 if (sync_driver::BackupRollbackController::IsBackupEnabled()) { |
365 // Backup is needed if user's not signed in or signed in but previous | 365 // Backup is needed if user's not signed in or signed in but previous |
366 // backup didn't finish, i.e. backend didn't switch from backup to sync. | 366 // backup didn't finish, i.e. backend didn't switch from backup to sync. |
367 need_backup_ = !IsSignedIn() || sync_prefs_.GetFirstSyncTime().is_null(); | 367 need_backup_ = !IsSignedIn() || sync_prefs_.GetFirstSyncTime().is_null(); |
368 | 368 |
369 // Try to resume rollback if it didn't finish in last session. | 369 // Try to resume rollback if it didn't finish in last session. |
370 running_rollback = backup_rollback_controller_->StartRollback(); | 370 running_rollback = backup_rollback_controller_->StartRollback(); |
371 } else { | 371 } else { |
372 need_backup_ = false; | 372 need_backup_ = false; |
373 } | 373 } |
374 | 374 |
(...skipping 1856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2231 // Track the fact that we're still waiting for auth to complete. | 2231 // Track the fact that we're still waiting for auth to complete. |
2232 is_auth_in_progress_ = true; | 2232 is_auth_in_progress_ = true; |
2233 } | 2233 } |
2234 } | 2234 } |
2235 | 2235 |
2236 void ProfileSyncService::GoogleSignedOut(const std::string& account_id, | 2236 void ProfileSyncService::GoogleSignedOut(const std::string& account_id, |
2237 const std::string& username) { | 2237 const std::string& username) { |
2238 sync_disabled_by_admin_ = false; | 2238 sync_disabled_by_admin_ = false; |
2239 RequestStop(CLEAR_DATA); | 2239 RequestStop(CLEAR_DATA); |
2240 | 2240 |
2241 if (browser_sync::BackupRollbackController::IsBackupEnabled()) { | 2241 if (sync_driver::BackupRollbackController::IsBackupEnabled()) { |
2242 need_backup_ = true; | 2242 need_backup_ = true; |
2243 backup_finished_ = false; | 2243 backup_finished_ = false; |
2244 } | 2244 } |
2245 } | 2245 } |
2246 | 2246 |
2247 void ProfileSyncService::AddObserver( | 2247 void ProfileSyncService::AddObserver( |
2248 sync_driver::SyncServiceObserver* observer) { | 2248 sync_driver::SyncServiceObserver* observer) { |
2249 observers_.AddObserver(observer); | 2249 observers_.AddObserver(observer); |
2250 } | 2250 } |
2251 | 2251 |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2724 } | 2724 } |
2725 | 2725 |
2726 std::string ProfileSyncService::unrecoverable_error_message() const { | 2726 std::string ProfileSyncService::unrecoverable_error_message() const { |
2727 return unrecoverable_error_message_; | 2727 return unrecoverable_error_message_; |
2728 } | 2728 } |
2729 | 2729 |
2730 tracked_objects::Location ProfileSyncService::unrecoverable_error_location() | 2730 tracked_objects::Location ProfileSyncService::unrecoverable_error_location() |
2731 const { | 2731 const { |
2732 return unrecoverable_error_location_; | 2732 return unrecoverable_error_location_; |
2733 } | 2733 } |
OLD | NEW |