Chromium Code Reviews| 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #include "chrome/browser/sync/glue/sync_backend_host.h" | 7 #include "chrome/browser/sync/glue/sync_backend_host.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 969 DCHECK(!registrar_); | 969 DCHECK(!registrar_); |
| 970 registrar_ = options.registrar; | 970 registrar_ = options.registrar; |
| 971 DCHECK(registrar_); | 971 DCHECK(registrar_); |
| 972 | 972 |
| 973 DCHECK(!chrome_sync_notification_bridge_); | 973 DCHECK(!chrome_sync_notification_bridge_); |
| 974 chrome_sync_notification_bridge_ = options.chrome_sync_notification_bridge; | 974 chrome_sync_notification_bridge_ = options.chrome_sync_notification_bridge; |
| 975 DCHECK(chrome_sync_notification_bridge_); | 975 DCHECK(chrome_sync_notification_bridge_); |
| 976 | 976 |
| 977 sync_manager_ = options.sync_manager_factory->CreateSyncManager(name_); | 977 sync_manager_ = options.sync_manager_factory->CreateSyncManager(name_); |
| 978 sync_manager_->AddObserver(this); | 978 sync_manager_->AddObserver(this); |
| 979 success = sync_manager_->Init( | 979 success = sync_manager_->Init( |
|
Nico
2012/07/31 17:50:51
nit: Consider using the buider pattern (
SyncIn
Nicolas Zea
2012/07/31 17:59:21
Yeah, it's not the prettiest. I'll file a bug to r
| |
| 980 sync_data_folder_path_, | 980 sync_data_folder_path_, |
| 981 options.event_handler, | 981 options.event_handler, |
| 982 options.service_url.host() + options.service_url.path(), | 982 options.service_url.host() + options.service_url.path(), |
| 983 options.service_url.EffectiveIntPort(), | 983 options.service_url.EffectiveIntPort(), |
| 984 options.service_url.SchemeIsSecure(), | 984 options.service_url.SchemeIsSecure(), |
| 985 BrowserThread::GetBlockingPool(), | 985 BrowserThread::GetBlockingPool(), |
| 986 options.make_http_bridge_factory_fn.Run().Pass(), | 986 options.make_http_bridge_factory_fn.Run().Pass(), |
| 987 options.workers, | 987 options.workers, |
| 988 options.extensions_activity_monitor, | 988 options.extensions_activity_monitor, |
| 989 options.registrar /* as SyncManager::ChangeDelegate */, | 989 options.registrar /* as SyncManager::ChangeDelegate */, |
| 990 options.credentials, | 990 options.credentials, |
| 991 scoped_ptr<syncer::SyncNotifier>(new BridgedSyncNotifier( | 991 scoped_ptr<syncer::SyncNotifier>(new BridgedSyncNotifier( |
| 992 options.chrome_sync_notification_bridge, | 992 options.chrome_sync_notification_bridge, |
| 993 options.sync_notifier_factory->CreateSyncNotifier())), | 993 options.sync_notifier_factory->CreateSyncNotifier())), |
| 994 options.restored_key_for_bootstrapping, | 994 options.restored_key_for_bootstrapping, |
| 995 CommandLine::ForCurrentProcess()->HasSwitch( | |
| 996 switches::kSyncKeystoreEncryption), | |
| 995 scoped_ptr<InternalComponentsFactory>( | 997 scoped_ptr<InternalComponentsFactory>( |
| 996 options.internal_components_factory), | 998 options.internal_components_factory), |
| 997 &encryptor_, | 999 &encryptor_, |
| 998 options.unrecoverable_error_handler, | 1000 options.unrecoverable_error_handler, |
| 999 options.report_unrecoverable_error_function); | 1001 options.report_unrecoverable_error_function); |
| 1000 LOG_IF(ERROR, !success) << "Syncapi initialization failed!"; | 1002 LOG_IF(ERROR, !success) << "Syncapi initialization failed!"; |
| 1001 | 1003 |
| 1002 // Now check the command line to see if we need to simulate an | 1004 // Now check the command line to see if we need to simulate an |
| 1003 // unrecoverable error for testing purpose. Note the error is thrown | 1005 // unrecoverable error for testing purpose. Note the error is thrown |
| 1004 // only if the initialization succeeded. Also it makes sense to use this | 1006 // only if the initialization succeeded. Also it makes sense to use this |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1379 FROM_HERE, | 1381 FROM_HERE, |
| 1380 base::Bind(&SyncBackendHost::Core::DoRefreshNigori, | 1382 base::Bind(&SyncBackendHost::Core::DoRefreshNigori, |
| 1381 core_.get(), sync_thread_done_callback)); | 1383 core_.get(), sync_thread_done_callback)); |
| 1382 } | 1384 } |
| 1383 | 1385 |
| 1384 #undef SDVLOG | 1386 #undef SDVLOG |
| 1385 | 1387 |
| 1386 #undef SLOG | 1388 #undef SLOG |
| 1387 | 1389 |
| 1388 } // namespace browser_sync | 1390 } // namespace browser_sync |
| OLD | NEW |