| 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 "sync/internal_api/sync_manager_impl.h" | 5 #include "sync/internal_api/sync_manager_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 const WeakHandle<JsEventHandler>& event_handler, | 333 const WeakHandle<JsEventHandler>& event_handler, |
| 334 const std::string& sync_server_and_path, | 334 const std::string& sync_server_and_path, |
| 335 int port, | 335 int port, |
| 336 bool use_ssl, | 336 bool use_ssl, |
| 337 scoped_ptr<HttpPostProviderFactory> post_factory, | 337 scoped_ptr<HttpPostProviderFactory> post_factory, |
| 338 const std::vector<ModelSafeWorker*>& workers, | 338 const std::vector<ModelSafeWorker*>& workers, |
| 339 ExtensionsActivityMonitor* extensions_activity_monitor, | 339 ExtensionsActivityMonitor* extensions_activity_monitor, |
| 340 SyncManager::ChangeDelegate* change_delegate, | 340 SyncManager::ChangeDelegate* change_delegate, |
| 341 const SyncCredentials& credentials, | 341 const SyncCredentials& credentials, |
| 342 scoped_ptr<Invalidator> invalidator, | 342 scoped_ptr<Invalidator> invalidator, |
| 343 const std::string& invalidator_client_id, |
| 343 const std::string& restored_key_for_bootstrapping, | 344 const std::string& restored_key_for_bootstrapping, |
| 344 const std::string& restored_keystore_key_for_bootstrapping, | 345 const std::string& restored_keystore_key_for_bootstrapping, |
| 345 scoped_ptr<InternalComponentsFactory> internal_components_factory, | 346 scoped_ptr<InternalComponentsFactory> internal_components_factory, |
| 346 Encryptor* encryptor, | 347 Encryptor* encryptor, |
| 347 UnrecoverableErrorHandler* unrecoverable_error_handler, | 348 UnrecoverableErrorHandler* unrecoverable_error_handler, |
| 348 ReportUnrecoverableErrorFunction report_unrecoverable_error_function) { | 349 ReportUnrecoverableErrorFunction report_unrecoverable_error_function) { |
| 349 CHECK(!initialized_); | 350 CHECK(!initialized_); |
| 350 DCHECK(thread_checker_.CalledOnValidThread()); | 351 DCHECK(thread_checker_.CalledOnValidThread()); |
| 351 DCHECK(post_factory.get()); | 352 DCHECK(post_factory.get()); |
| 352 DCHECK(!credentials.email.empty()); | 353 DCHECK(!credentials.email.empty()); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 return; | 411 return; |
| 411 } | 412 } |
| 412 | 413 |
| 413 connection_manager_.reset(new SyncAPIServerConnectionManager( | 414 connection_manager_.reset(new SyncAPIServerConnectionManager( |
| 414 sync_server_and_path, port, use_ssl, post_factory.release())); | 415 sync_server_and_path, port, use_ssl, post_factory.release())); |
| 415 connection_manager_->set_client_id(directory()->cache_guid()); | 416 connection_manager_->set_client_id(directory()->cache_guid()); |
| 416 connection_manager_->AddListener(this); | 417 connection_manager_->AddListener(this); |
| 417 | 418 |
| 418 std::string sync_id = directory()->cache_guid(); | 419 std::string sync_id = directory()->cache_guid(); |
| 419 | 420 |
| 420 // TODO(rlarocque): The invalidator client ID should be independent from the | |
| 421 // sync client ID. See crbug.com/124142. | |
| 422 const std::string invalidator_client_id = sync_id; | |
| 423 | |
| 424 allstatus_.SetSyncId(sync_id); | 421 allstatus_.SetSyncId(sync_id); |
| 425 allstatus_.SetInvalidatorClientId(invalidator_client_id); | 422 allstatus_.SetInvalidatorClientId(invalidator_client_id); |
| 426 | 423 |
| 427 DVLOG(1) << "Setting sync client ID: " << sync_id; | 424 DVLOG(1) << "Setting sync client ID: " << sync_id; |
| 428 DVLOG(1) << "Setting invalidator client ID: " << invalidator_client_id; | 425 DVLOG(1) << "Setting invalidator client ID: " << invalidator_client_id; |
| 429 invalidator_->SetUniqueId(invalidator_client_id); | |
| 430 | 426 |
| 431 // Build a SyncSessionContext and store the worker in it. | 427 // Build a SyncSessionContext and store the worker in it. |
| 432 DVLOG(1) << "Sync is bringing up SyncSessionContext."; | 428 DVLOG(1) << "Sync is bringing up SyncSessionContext."; |
| 433 std::vector<SyncEngineEventListener*> listeners; | 429 std::vector<SyncEngineEventListener*> listeners; |
| 434 listeners.push_back(&allstatus_); | 430 listeners.push_back(&allstatus_); |
| 435 listeners.push_back(this); | 431 listeners.push_back(this); |
| 436 session_context_ = internal_components_factory->BuildContext( | 432 session_context_ = internal_components_factory->BuildContext( |
| 437 connection_manager_.get(), | 433 connection_manager_.get(), |
| 438 directory(), | 434 directory(), |
| 439 workers, | 435 workers, |
| (...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1402 int SyncManagerImpl::GetDefaultNudgeDelay() { | 1398 int SyncManagerImpl::GetDefaultNudgeDelay() { |
| 1403 return kDefaultNudgeDelayMilliseconds; | 1399 return kDefaultNudgeDelayMilliseconds; |
| 1404 } | 1400 } |
| 1405 | 1401 |
| 1406 // static. | 1402 // static. |
| 1407 int SyncManagerImpl::GetPreferencesNudgeDelay() { | 1403 int SyncManagerImpl::GetPreferencesNudgeDelay() { |
| 1408 return kPreferencesNudgeDelayMilliseconds; | 1404 return kPreferencesNudgeDelayMilliseconds; |
| 1409 } | 1405 } |
| 1410 | 1406 |
| 1411 } // namespace syncer | 1407 } // namespace syncer |
| OLD | NEW |