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 <set> | 9 #include <set> |
10 #include <utility> | 10 #include <utility> |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 } | 320 } |
321 return credentials; | 321 return credentials; |
322 } | 322 } |
323 | 323 |
324 void ProfileSyncService::InitializeBackend(bool delete_stale_data) { | 324 void ProfileSyncService::InitializeBackend(bool delete_stale_data) { |
325 if (!backend_.get()) { | 325 if (!backend_.get()) { |
326 NOTREACHED(); | 326 NOTREACHED(); |
327 return; | 327 return; |
328 } | 328 } |
329 | 329 |
330 syncer::ModelTypeSet initial_types; | |
331 // If sync setup hasn't finished, we don't want to initialize routing info | |
332 // for any data types so that we don't download updates for types that the | |
333 // user chooses not to sync on the first DownloadUpdatesCommand. | |
334 if (HasSyncSetupCompleted()) { | |
335 initial_types = GetPreferredDataTypes(); | |
336 } | |
337 | |
338 SyncCredentials credentials = GetCredentials(); | 330 SyncCredentials credentials = GetCredentials(); |
339 | 331 |
340 scoped_refptr<net::URLRequestContextGetter> request_context_getter( | 332 scoped_refptr<net::URLRequestContextGetter> request_context_getter( |
341 profile_->GetRequestContext()); | 333 profile_->GetRequestContext()); |
342 | 334 |
343 if (delete_stale_data) | 335 if (delete_stale_data) |
344 ClearStaleErrors(); | 336 ClearStaleErrors(); |
345 | 337 |
346 backend_unrecoverable_error_handler_.reset( | 338 backend_unrecoverable_error_handler_.reset( |
347 new browser_sync::BackendUnrecoverableErrorHandler( | 339 new browser_sync::BackendUnrecoverableErrorHandler( |
348 MakeWeakHandle(weak_factory_.GetWeakPtr()))); | 340 MakeWeakHandle(weak_factory_.GetWeakPtr()))); |
349 | 341 |
350 backend_->Initialize( | 342 backend_->Initialize( |
351 this, | 343 this, |
352 MakeWeakHandle(sync_js_controller_.AsWeakPtr()), | 344 MakeWeakHandle(sync_js_controller_.AsWeakPtr()), |
353 sync_service_url_, | 345 sync_service_url_, |
354 initial_types, | |
355 credentials, | 346 credentials, |
356 delete_stale_data, | 347 delete_stale_data, |
357 &sync_manager_factory_, | 348 &sync_manager_factory_, |
358 backend_unrecoverable_error_handler_.get(), | 349 backend_unrecoverable_error_handler_.get(), |
359 &browser_sync::ChromeReportUnrecoverableError); | 350 &browser_sync::ChromeReportUnrecoverableError); |
360 } | 351 } |
361 | 352 |
362 void ProfileSyncService::CreateBackend() { | 353 void ProfileSyncService::CreateBackend() { |
363 backend_.reset( | 354 backend_.reset( |
364 new SyncBackendHost(profile_->GetDebugName(), | 355 new SyncBackendHost(profile_->GetDebugName(), |
(...skipping 1399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1764 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine
d-behaviour-after-directly-calling-the-destru. | 1755 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine
d-behaviour-after-directly-calling-the-destru. |
1765 ProfileSyncService* old_this = this; | 1756 ProfileSyncService* old_this = this; |
1766 this->~ProfileSyncService(); | 1757 this->~ProfileSyncService(); |
1767 new(old_this) ProfileSyncService( | 1758 new(old_this) ProfileSyncService( |
1768 new ProfileSyncComponentsFactoryImpl(profile, | 1759 new ProfileSyncComponentsFactoryImpl(profile, |
1769 CommandLine::ForCurrentProcess()), | 1760 CommandLine::ForCurrentProcess()), |
1770 profile, | 1761 profile, |
1771 signin, | 1762 signin, |
1772 behavior); | 1763 behavior); |
1773 } | 1764 } |
OLD | NEW |