| 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 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 false, ModelTypeSet())); | 410 false, ModelTypeSet())); |
| 411 LOG(ERROR) << "Sync manager initialization failed!"; | 411 LOG(ERROR) << "Sync manager initialization failed!"; |
| 412 return; | 412 return; |
| 413 } | 413 } |
| 414 | 414 |
| 415 connection_manager_.reset(new SyncAPIServerConnectionManager( | 415 connection_manager_.reset(new SyncAPIServerConnectionManager( |
| 416 sync_server_and_path, port, use_ssl, post_factory.release())); | 416 sync_server_and_path, port, use_ssl, post_factory.release())); |
| 417 connection_manager_->set_client_id(directory()->cache_guid()); | 417 connection_manager_->set_client_id(directory()->cache_guid()); |
| 418 connection_manager_->AddListener(this); | 418 connection_manager_->AddListener(this); |
| 419 | 419 |
| 420 // Retrieve and set the sync notifier id. | 420 std::string sync_id = directory()->cache_guid(); |
| 421 std::string unique_id = directory()->cache_guid(); | 421 |
| 422 DVLOG(1) << "Read notification unique ID: " << unique_id; | 422 // TODO(rlarocque): The invalidator client ID should be independent from the |
| 423 allstatus_.SetUniqueId(unique_id); | 423 // sync client ID. See crbug.com/124142. |
| 424 invalidator_->SetUniqueId(unique_id); | 424 const std::string invalidator_client_id = sync_id; |
| 425 |
| 426 allstatus_.SetSyncId(sync_id); |
| 427 allstatus_.SetInvalidatorClientId(invalidator_client_id); |
| 428 |
| 429 DVLOG(1) << "Setting sync client ID: " << sync_id; |
| 430 DVLOG(1) << "Setting invalidator client ID: " << invalidator_client_id; |
| 425 | 431 |
| 426 // Build a SyncSessionContext and store the worker in it. | 432 // Build a SyncSessionContext and store the worker in it. |
| 427 DVLOG(1) << "Sync is bringing up SyncSessionContext."; | 433 DVLOG(1) << "Sync is bringing up SyncSessionContext."; |
| 428 std::vector<SyncEngineEventListener*> listeners; | 434 std::vector<SyncEngineEventListener*> listeners; |
| 429 listeners.push_back(&allstatus_); | 435 listeners.push_back(&allstatus_); |
| 430 listeners.push_back(this); | 436 listeners.push_back(this); |
| 431 session_context_ = internal_components_factory->BuildContext( | 437 session_context_ = internal_components_factory->BuildContext( |
| 432 connection_manager_.get(), | 438 connection_manager_.get(), |
| 433 directory(), | 439 directory(), |
| 434 workers, | 440 workers, |
| 435 extensions_activity_monitor, | 441 extensions_activity_monitor, |
| 436 &throttled_data_type_tracker_, | 442 &throttled_data_type_tracker_, |
| 437 listeners, | 443 listeners, |
| 438 &debug_info_event_listener_, | 444 &debug_info_event_listener_, |
| 439 &traffic_recorder_).Pass(); | 445 &traffic_recorder_, |
| 446 invalidator_client_id).Pass(); |
| 440 session_context_->set_account_name(credentials.email); | 447 session_context_->set_account_name(credentials.email); |
| 441 scheduler_ = internal_components_factory->BuildScheduler( | 448 scheduler_ = internal_components_factory->BuildScheduler( |
| 442 name_, session_context_.get()).Pass(); | 449 name_, session_context_.get()).Pass(); |
| 443 | 450 |
| 444 scheduler_->Start(SyncScheduler::CONFIGURATION_MODE); | 451 scheduler_->Start(SyncScheduler::CONFIGURATION_MODE); |
| 445 | 452 |
| 446 initialized_ = true; | 453 initialized_ = true; |
| 447 | 454 |
| 448 net::NetworkChangeNotifier::AddIPAddressObserver(this); | 455 net::NetworkChangeNotifier::AddIPAddressObserver(this); |
| 449 net::NetworkChangeNotifier::AddConnectionTypeObserver(this); | 456 net::NetworkChangeNotifier::AddConnectionTypeObserver(this); |
| (...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1384 int SyncManagerImpl::GetDefaultNudgeDelay() { | 1391 int SyncManagerImpl::GetDefaultNudgeDelay() { |
| 1385 return kDefaultNudgeDelayMilliseconds; | 1392 return kDefaultNudgeDelayMilliseconds; |
| 1386 } | 1393 } |
| 1387 | 1394 |
| 1388 // static. | 1395 // static. |
| 1389 int SyncManagerImpl::GetPreferencesNudgeDelay() { | 1396 int SyncManagerImpl::GetPreferencesNudgeDelay() { |
| 1390 return kPreferencesNudgeDelayMilliseconds; | 1397 return kPreferencesNudgeDelayMilliseconds; |
| 1391 } | 1398 } |
| 1392 | 1399 |
| 1393 } // namespace syncer | 1400 } // namespace syncer |
| OLD | NEW |