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 "components/browser_sync/browser/profile_sync_service.h" | 5 #include "components/browser_sync/browser/profile_sync_service.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <cstddef> | 8 #include <cstddef> |
9 #include <map> | 9 #include <map> |
10 #include <utility> | 10 #include <utility> |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 DCHECK(sync_error_controller_ == NULL) | 374 DCHECK(sync_error_controller_ == NULL) |
375 << "Initialize() called more than once."; | 375 << "Initialize() called more than once."; |
376 sync_error_controller_.reset(new SyncErrorController(this)); | 376 sync_error_controller_.reset(new SyncErrorController(this)); |
377 AddObserver(sync_error_controller_.get()); | 377 AddObserver(sync_error_controller_.get()); |
378 #endif | 378 #endif |
379 | 379 |
380 memory_pressure_listener_.reset(new base::MemoryPressureListener( | 380 memory_pressure_listener_.reset(new base::MemoryPressureListener( |
381 base::Bind(&ProfileSyncService::OnMemoryPressure, | 381 base::Bind(&ProfileSyncService::OnMemoryPressure, |
382 sync_enabled_weak_factory_.GetWeakPtr()))); | 382 sync_enabled_weak_factory_.GetWeakPtr()))); |
383 startup_controller_->Reset(GetRegisteredDataTypes()); | 383 startup_controller_->Reset(GetRegisteredDataTypes()); |
384 startup_controller_->TryStart(); | 384 |
| 385 // Auto-start means means the first time the profile starts up, sync should |
| 386 // start up immediately. |
| 387 if (start_behavior_ == AUTO_START && !IsFirstSetupComplete()) { |
| 388 startup_controller_->TryStartImmediately(); |
| 389 } else { |
| 390 startup_controller_->TryStart(); |
| 391 } |
385 } | 392 } |
386 | 393 |
387 void ProfileSyncService::StartSyncingWithServer() { | 394 void ProfileSyncService::StartSyncingWithServer() { |
388 DCHECK(thread_checker_.CalledOnValidThread()); | 395 DCHECK(thread_checker_.CalledOnValidThread()); |
389 | 396 |
390 if (base::FeatureList::IsEnabled( | 397 if (base::FeatureList::IsEnabled( |
391 switches::kSyncClearDataOnPassphraseEncryption) && | 398 switches::kSyncClearDataOnPassphraseEncryption) && |
392 sync_prefs_.GetPassphraseEncryptionTransitionInProgress()) { | 399 sync_prefs_.GetPassphraseEncryptionTransitionInProgress()) { |
393 BeginConfigureCatchUpBeforeClear(); | 400 BeginConfigureCatchUpBeforeClear(); |
394 return; | 401 return; |
(...skipping 2131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2526 if (--outstanding_setup_in_progress_handles_ != 0) | 2533 if (--outstanding_setup_in_progress_handles_ != 0) |
2527 return; | 2534 return; |
2528 | 2535 |
2529 DCHECK(startup_controller_->IsSetupInProgress()); | 2536 DCHECK(startup_controller_->IsSetupInProgress()); |
2530 startup_controller_->SetSetupInProgress(false); | 2537 startup_controller_->SetSetupInProgress(false); |
2531 | 2538 |
2532 if (IsBackendInitialized()) | 2539 if (IsBackendInitialized()) |
2533 ReconfigureDatatypeManager(); | 2540 ReconfigureDatatypeManager(); |
2534 NotifyObservers(); | 2541 NotifyObservers(); |
2535 } | 2542 } |
OLD | NEW |