Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(680)

Unified Diff: chrome/browser/sync/profile_sync_service.cc

Issue 367153005: Sync: Refactoring of DEVICE_INFO syncable type - Part 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed build issues in browser_tests Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/profile_sync_service.cc
diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc
index f4ab21aecc238e9d4cc0d9a32074e28c4ac97ded..e28bdcfebefcb119e339729d7ec621d0a4a30770 100644
--- a/chrome/browser/sync/profile_sync_service.cc
+++ b/chrome/browser/sync/profile_sync_service.cc
@@ -240,8 +240,12 @@ ProfileSyncService::ProfileSyncService(
sync_start_util::GetFlareForSyncableService(profile->GetPath()));
scoped_ptr<browser_sync::LocalSessionEventRouter> router(
new NotificationServiceSessionsRouter(profile, flare));
+
+ local_device_info_provider_.reset(new LocalDeviceInfoProviderImpl());
sessions_sync_manager_.reset(
- new SessionsSyncManager(profile, this, router.Pass()));
+ new SessionsSyncManager(profile,
+ local_device_info_provider_.get(),
+ router.Pass()));
}
ProfileSyncService::~ProfileSyncService() {
@@ -421,15 +425,14 @@ browser_sync::FaviconCache* ProfileSyncService::GetFaviconCache() {
return sessions_sync_manager_->GetFaviconCache();
}
-scoped_ptr<browser_sync::DeviceInfo>
-ProfileSyncService::GetLocalDeviceInfo() const {
- if (HasSyncingBackend()) {
- browser_sync::SyncedDeviceTracker* device_tracker =
- backend_->GetSyncedDeviceTracker();
- if (device_tracker)
- return device_tracker->ReadLocalDeviceInfo();
- }
- return scoped_ptr<browser_sync::DeviceInfo>();
+browser_sync::SyncedWindowDelegatesGetter*
+ProfileSyncService::GetSyncedWindowDelegatesGetter() const {
+ return sessions_sync_manager_->GetSyncedWindowDelegatesGetter();
+}
+
+browser_sync::LocalDeviceInfoProvider*
+ProfileSyncService::GetLocalDeviceInfoProvider() {
+ return local_device_info_provider_.get();
}
scoped_ptr<browser_sync::DeviceInfo>
@@ -457,17 +460,6 @@ ScopedVector<browser_sync::DeviceInfo>
return devices.Pass();
}
-std::string ProfileSyncService::GetLocalSyncCacheGUID() const {
- if (HasSyncingBackend()) {
- browser_sync::SyncedDeviceTracker* device_tracker =
- backend_->GetSyncedDeviceTracker();
- if (device_tracker) {
- return device_tracker->cache_guid();
- }
- }
- return std::string();
-}
-
// Notifies the observer of any device info changes.
void ProfileSyncService::AddObserverForDeviceInfoChange(
browser_sync::SyncedDeviceTracker::Observer* observer) {
@@ -1058,6 +1050,7 @@ void ProfileSyncService::OnBackendInitialized(
const syncer::WeakHandle<syncer::JsBackend>& js_backend,
const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>&
debug_info_listener,
+ const std::string& cache_guid,
bool success) {
UpdateBackendInitUMA(success);
@@ -1086,6 +1079,9 @@ void ProfileSyncService::OnBackendInitialized(
sync_js_controller_.AttachJsBackend(js_backend);
debug_info_listener_ = debug_info_listener;
+ // Initialize local device info.
+ local_device_info_provider_->Initialize(cache_guid);
+
// Give the DataTypeControllers a handle to the now initialized backend
// as a UserShare.
for (DataTypeController::TypeMap::iterator it =

Powered by Google App Engine
This is Rietveld 408576698