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