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 1796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1807 NOTREACHED(); | 1807 NOTREACHED(); |
1808 return; | 1808 return; |
1809 } | 1809 } |
1810 | 1810 |
1811 UpdateSelectedTypesHistogram(sync_everything, chosen_types); | 1811 UpdateSelectedTypesHistogram(sync_everything, chosen_types); |
1812 sync_prefs_.SetKeepEverythingSynced(sync_everything); | 1812 sync_prefs_.SetKeepEverythingSynced(sync_everything); |
1813 | 1813 |
1814 if (directory_data_type_manager_.get()) | 1814 if (directory_data_type_manager_.get()) |
1815 directory_data_type_manager_->ResetDataTypeErrors(); | 1815 directory_data_type_manager_->ResetDataTypeErrors(); |
1816 ChangePreferredDataTypes(chosen_types); | 1816 ChangePreferredDataTypes(chosen_types); |
1817 AcknowledgeSyncedTypes(); | |
1818 } | 1817 } |
1819 | 1818 |
1820 void ProfileSyncService::ChangePreferredDataTypes( | 1819 void ProfileSyncService::ChangePreferredDataTypes( |
1821 syncer::ModelTypeSet preferred_types) { | 1820 syncer::ModelTypeSet preferred_types) { |
1822 | 1821 |
1823 DVLOG(1) << "ChangePreferredDataTypes invoked"; | 1822 DVLOG(1) << "ChangePreferredDataTypes invoked"; |
1824 const syncer::ModelTypeSet registered_types = GetRegisteredDataTypes(); | 1823 const syncer::ModelTypeSet registered_types = GetRegisteredDataTypes(); |
1825 const syncer::ModelTypeSet registered_preferred_types = | 1824 const syncer::ModelTypeSet registered_preferred_types = |
1826 Intersection(registered_types, preferred_types); | 1825 Intersection(registered_types, preferred_types); |
1827 sync_prefs_.SetPreferredDataTypes(registered_types, | 1826 sync_prefs_.SetPreferredDataTypes(registered_types, |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2497 return signin_->GetOriginal(); | 2496 return signin_->GetOriginal(); |
2498 } | 2497 } |
2499 | 2498 |
2500 void ProfileSyncService::UnsuppressAndStart() { | 2499 void ProfileSyncService::UnsuppressAndStart() { |
2501 DCHECK(profile_); | 2500 DCHECK(profile_); |
2502 sync_prefs_.SetStartSuppressed(false); | 2501 sync_prefs_.SetStartSuppressed(false); |
2503 DCHECK(!signin_.get() || signin_->GetOriginal()->IsAuthenticated()); | 2502 DCHECK(!signin_.get() || signin_->GetOriginal()->IsAuthenticated()); |
2504 startup_controller_->TryStart(); | 2503 startup_controller_->TryStart(); |
2505 } | 2504 } |
2506 | 2505 |
2507 void ProfileSyncService::AcknowledgeSyncedTypes() { | |
2508 sync_prefs_.AcknowledgeSyncedTypes(GetRegisteredDataTypes()); | |
2509 } | |
2510 | |
2511 void ProfileSyncService::ReconfigureDatatypeManager() { | 2506 void ProfileSyncService::ReconfigureDatatypeManager() { |
2512 // If we haven't initialized yet, don't configure the DTM as it could cause | 2507 // If we haven't initialized yet, don't configure the DTM as it could cause |
2513 // association to start before a Directory has even been created. | 2508 // association to start before a Directory has even been created. |
2514 if (backend_initialized_) { | 2509 if (backend_initialized_) { |
2515 DCHECK(backend_.get()); | 2510 DCHECK(backend_.get()); |
2516 ConfigureDataTypeManager(); | 2511 ConfigureDataTypeManager(); |
2517 } else if (HasUnrecoverableError()) { | 2512 } else if (HasUnrecoverableError()) { |
2518 // There is nothing more to configure. So inform the listeners, | 2513 // There is nothing more to configure. So inform the listeners, |
2519 NotifyObservers(); | 2514 NotifyObservers(); |
2520 | 2515 |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2772 std::string birthday; | 2767 std::string birthday; |
2773 syncer::UserShare* user_share = GetUserShare(); | 2768 syncer::UserShare* user_share = GetUserShare(); |
2774 if (user_share && user_share->directory.get()) { | 2769 if (user_share && user_share->directory.get()) { |
2775 birthday = user_share->directory->store_birthday(); | 2770 birthday = user_share->directory->store_birthday(); |
2776 } | 2771 } |
2777 if (!access_token_.empty() && !cache_guid.empty() && !birthday.empty()) { | 2772 if (!access_token_.empty() && !cache_guid.empty() && !birthday.empty()) { |
2778 sync_stopped_reporter_->ReportSyncStopped( | 2773 sync_stopped_reporter_->ReportSyncStopped( |
2779 access_token_, cache_guid, birthday); | 2774 access_token_, cache_guid, birthday); |
2780 } | 2775 } |
2781 } | 2776 } |
OLD | NEW |