| 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 | 8 |
| 9 #include <cstddef> | 9 #include <cstddef> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 #include "components/sync/driver/signin_manager_wrapper.h" | 68 #include "components/sync/driver/signin_manager_wrapper.h" |
| 69 #include "components/sync/driver/sync_api_component_factory.h" | 69 #include "components/sync/driver/sync_api_component_factory.h" |
| 70 #include "components/sync/driver/sync_client.h" | 70 #include "components/sync/driver/sync_client.h" |
| 71 #include "components/sync/driver/sync_driver_switches.h" | 71 #include "components/sync/driver/sync_driver_switches.h" |
| 72 #include "components/sync/driver/sync_error_controller.h" | 72 #include "components/sync/driver/sync_error_controller.h" |
| 73 #include "components/sync/driver/sync_stopped_reporter.h" | 73 #include "components/sync/driver/sync_stopped_reporter.h" |
| 74 #include "components/sync/driver/sync_type_preference_provider.h" | 74 #include "components/sync/driver/sync_type_preference_provider.h" |
| 75 #include "components/sync/driver/sync_util.h" | 75 #include "components/sync/driver/sync_util.h" |
| 76 #include "components/sync/driver/system_encryptor.h" | 76 #include "components/sync/driver/system_encryptor.h" |
| 77 #include "components/sync/driver/user_selectable_sync_type.h" | 77 #include "components/sync/driver/user_selectable_sync_type.h" |
| 78 #include "components/sync/engine/cycle/model_neutral_state.h" |
| 79 #include "components/sync/engine/cycle/type_debug_info_observer.h" |
| 78 #include "components/sync/engine/sync_string_conversions.h" | 80 #include "components/sync/engine/sync_string_conversions.h" |
| 79 #include "components/sync/js/js_event_details.h" | 81 #include "components/sync/js/js_event_details.h" |
| 80 #include "components/sync/protocol/sync.pb.h" | 82 #include "components/sync/protocol/sync.pb.h" |
| 81 #include "components/sync/sessions/model_neutral_state.h" | |
| 82 #include "components/sync/sessions/type_debug_info_observer.h" | |
| 83 #include "components/sync/syncable/directory.h" | 83 #include "components/sync/syncable/directory.h" |
| 84 #include "components/sync_sessions/favicon_cache.h" | 84 #include "components/sync_sessions/favicon_cache.h" |
| 85 #include "components/sync_sessions/session_data_type_controller.h" | 85 #include "components/sync_sessions/session_data_type_controller.h" |
| 86 #include "components/sync_sessions/sessions_sync_manager.h" | 86 #include "components/sync_sessions/sessions_sync_manager.h" |
| 87 #include "components/sync_sessions/sync_sessions_client.h" | 87 #include "components/sync_sessions/sync_sessions_client.h" |
| 88 #include "components/syncable_prefs/pref_service_syncable.h" | 88 #include "components/syncable_prefs/pref_service_syncable.h" |
| 89 #include "components/version_info/version_info_values.h" | 89 #include "components/version_info/version_info_values.h" |
| 90 #include "net/cookies/cookie_monster.h" | 90 #include "net/cookies/cookie_monster.h" |
| 91 #include "net/url_request/url_request_context_getter.h" | 91 #include "net/url_request/url_request_context_getter.h" |
| 92 #include "ui/base/l10n/l10n_util.h" | 92 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1018 | 1018 |
| 1019 // Initialize local device info. | 1019 // Initialize local device info. |
| 1020 local_device_->Initialize(cache_guid, signin_scoped_device_id, | 1020 local_device_->Initialize(cache_guid, signin_scoped_device_id, |
| 1021 blocking_pool_); | 1021 blocking_pool_); |
| 1022 | 1022 |
| 1023 PostBackendInitialization(); | 1023 PostBackendInitialization(); |
| 1024 } | 1024 } |
| 1025 | 1025 |
| 1026 void ProfileSyncService::OnSyncCycleCompleted() { | 1026 void ProfileSyncService::OnSyncCycleCompleted() { |
| 1027 UpdateLastSyncedTime(); | 1027 UpdateLastSyncedTime(); |
| 1028 const syncer::sessions::SyncSessionSnapshot snapshot = | 1028 const syncer::SyncCycleSnapshot snapshot = GetLastCycleSnapshot(); |
| 1029 GetLastSessionSnapshot(); | |
| 1030 if (IsDataTypeControllerRunning(syncer::SESSIONS) && | 1029 if (IsDataTypeControllerRunning(syncer::SESSIONS) && |
| 1031 snapshot.model_neutral_state().get_updates_request_types.Has( | 1030 snapshot.model_neutral_state().get_updates_request_types.Has( |
| 1032 syncer::SESSIONS) && | 1031 syncer::SESSIONS) && |
| 1033 !syncer::sessions::HasSyncerError(snapshot.model_neutral_state())) { | 1032 !syncer::HasSyncerError(snapshot.model_neutral_state())) { |
| 1034 // Trigger garbage collection of old sessions now that we've downloaded | 1033 // Trigger garbage collection of old sessions now that we've downloaded |
| 1035 // any new session data. | 1034 // any new session data. |
| 1036 base::ThreadTaskRunnerHandle::Get()->PostTask( | 1035 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 1037 FROM_HERE, base::Bind(&SessionsSyncManager::DoGarbageCollection, | 1036 FROM_HERE, base::Bind(&SessionsSyncManager::DoGarbageCollection, |
| 1038 base::AsWeakPtr(sessions_sync_manager_.get()))); | 1037 base::AsWeakPtr(sessions_sync_manager_.get()))); |
| 1039 } | 1038 } |
| 1040 DVLOG(2) << "Notifying observers sync cycle completed"; | 1039 DVLOG(2) << "Notifying observers sync cycle completed"; |
| 1041 NotifySyncCycleCompleted(); | 1040 NotifySyncCycleCompleted(); |
| 1042 } | 1041 } |
| 1043 | 1042 |
| (...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1807 } | 1806 } |
| 1808 | 1807 |
| 1809 syncer::UserShare* ProfileSyncService::GetUserShare() const { | 1808 syncer::UserShare* ProfileSyncService::GetUserShare() const { |
| 1810 if (backend_.get() && backend_initialized_) { | 1809 if (backend_.get() && backend_initialized_) { |
| 1811 return backend_->GetUserShare(); | 1810 return backend_->GetUserShare(); |
| 1812 } | 1811 } |
| 1813 NOTREACHED(); | 1812 NOTREACHED(); |
| 1814 return NULL; | 1813 return NULL; |
| 1815 } | 1814 } |
| 1816 | 1815 |
| 1817 syncer::sessions::SyncSessionSnapshot | 1816 syncer::SyncCycleSnapshot ProfileSyncService::GetLastCycleSnapshot() const { |
| 1818 ProfileSyncService::GetLastSessionSnapshot() const { | |
| 1819 if (backend_) | 1817 if (backend_) |
| 1820 return backend_->GetLastSessionSnapshot(); | 1818 return backend_->GetLastCycleSnapshot(); |
| 1821 return syncer::sessions::SyncSessionSnapshot(); | 1819 return syncer::SyncCycleSnapshot(); |
| 1822 } | 1820 } |
| 1823 | 1821 |
| 1824 bool ProfileSyncService::HasUnsyncedItems() const { | 1822 bool ProfileSyncService::HasUnsyncedItems() const { |
| 1825 if (HasSyncingBackend() && backend_initialized_) { | 1823 if (HasSyncingBackend() && backend_initialized_) { |
| 1826 return backend_->HasUnsyncedItems(); | 1824 return backend_->HasUnsyncedItems(); |
| 1827 } | 1825 } |
| 1828 NOTREACHED(); | 1826 NOTREACHED(); |
| 1829 return false; | 1827 return false; |
| 1830 } | 1828 } |
| 1831 | 1829 |
| (...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2535 if (--outstanding_setup_in_progress_handles_ != 0) | 2533 if (--outstanding_setup_in_progress_handles_ != 0) |
| 2536 return; | 2534 return; |
| 2537 | 2535 |
| 2538 DCHECK(startup_controller_->IsSetupInProgress()); | 2536 DCHECK(startup_controller_->IsSetupInProgress()); |
| 2539 startup_controller_->SetSetupInProgress(false); | 2537 startup_controller_->SetSetupInProgress(false); |
| 2540 | 2538 |
| 2541 if (IsBackendInitialized()) | 2539 if (IsBackendInitialized()) |
| 2542 ReconfigureDatatypeManager(); | 2540 ReconfigureDatatypeManager(); |
| 2543 NotifyObservers(); | 2541 NotifyObservers(); |
| 2544 } | 2542 } |
| OLD | NEW |