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 "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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 #include "sync/protocol/sync.pb.h" | 43 #include "sync/protocol/sync.pb.h" |
| 44 #include "sync/sessions/directory_type_debug_info_emitter.h" | 44 #include "sync/sessions/directory_type_debug_info_emitter.h" |
| 45 #include "sync/syncable/directory.h" | 45 #include "sync/syncable/directory.h" |
| 46 #include "sync/syncable/entry.h" | 46 #include "sync/syncable/entry.h" |
| 47 #include "sync/syncable/in_memory_directory_backing_store.h" | 47 #include "sync/syncable/in_memory_directory_backing_store.h" |
| 48 #include "sync/syncable/on_disk_directory_backing_store.h" | 48 #include "sync/syncable/on_disk_directory_backing_store.h" |
| 49 | 49 |
| 50 using base::TimeDelta; | 50 using base::TimeDelta; |
| 51 using sync_pb::GetUpdatesCallerInfo; | 51 using sync_pb::GetUpdatesCallerInfo; |
| 52 | 52 |
| 53 class GURL; | |
| 54 | |
| 53 namespace syncer { | 55 namespace syncer { |
| 54 | 56 |
| 55 using sessions::SyncSessionContext; | 57 using sessions::SyncSessionContext; |
| 56 using syncable::ImmutableWriteTransactionInfo; | 58 using syncable::ImmutableWriteTransactionInfo; |
| 57 using syncable::SPECIFICS; | 59 using syncable::SPECIFICS; |
| 58 using syncable::UNIQUE_POSITION; | 60 using syncable::UNIQUE_POSITION; |
| 59 | 61 |
| 60 namespace { | 62 namespace { |
| 61 | 63 |
| 62 // Delays for syncer nudges. | 64 // Delays for syncer nudges. |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 297 ready_task, | 299 ready_task, |
| 298 retry_task); | 300 retry_task); |
| 299 | 301 |
| 300 scheduler_->Start(SyncScheduler::CONFIGURATION_MODE); | 302 scheduler_->Start(SyncScheduler::CONFIGURATION_MODE); |
| 301 scheduler_->ScheduleConfiguration(params); | 303 scheduler_->ScheduleConfiguration(params); |
| 302 } | 304 } |
| 303 | 305 |
| 304 void SyncManagerImpl::Init( | 306 void SyncManagerImpl::Init( |
| 305 const base::FilePath& database_location, | 307 const base::FilePath& database_location, |
| 306 const WeakHandle<JsEventHandler>& event_handler, | 308 const WeakHandle<JsEventHandler>& event_handler, |
| 307 const std::string& sync_server_and_path, | 309 const GURL& service_url, |
| 308 int port, | |
| 309 bool use_ssl, | |
| 310 scoped_ptr<HttpPostProviderFactory> post_factory, | 310 scoped_ptr<HttpPostProviderFactory> post_factory, |
| 311 const std::vector<scoped_refptr<ModelSafeWorker> >& workers, | 311 const std::vector<scoped_refptr<ModelSafeWorker> >& workers, |
| 312 ExtensionsActivity* extensions_activity, | 312 ExtensionsActivity* extensions_activity, |
| 313 SyncManager::ChangeDelegate* change_delegate, | 313 SyncManager::ChangeDelegate* change_delegate, |
| 314 const SyncCredentials& credentials, | 314 const SyncCredentials& credentials, |
| 315 const std::string& invalidator_client_id, | 315 const std::string& invalidator_client_id, |
| 316 const std::string& restored_key_for_bootstrapping, | 316 const std::string& restored_key_for_bootstrapping, |
| 317 const std::string& restored_keystore_key_for_bootstrapping, | 317 const std::string& restored_keystore_key_for_bootstrapping, |
| 318 InternalComponentsFactory* internal_components_factory, | 318 InternalComponentsFactory* internal_components_factory, |
| 319 Encryptor* encryptor, | 319 Encryptor* encryptor, |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 377 | 377 |
| 378 const std::string& username = credentials.email; | 378 const std::string& username = credentials.email; |
| 379 DVLOG(1) << "Username: " << username; | 379 DVLOG(1) << "Username: " << username; |
| 380 if (!OpenDirectory(username)) { | 380 if (!OpenDirectory(username)) { |
| 381 NotifyInitializationFailure(); | 381 NotifyInitializationFailure(); |
| 382 LOG(ERROR) << "Sync manager initialization failed!"; | 382 LOG(ERROR) << "Sync manager initialization failed!"; |
| 383 return; | 383 return; |
| 384 } | 384 } |
| 385 | 385 |
| 386 connection_manager_.reset(new SyncAPIServerConnectionManager( | 386 connection_manager_.reset(new SyncAPIServerConnectionManager( |
| 387 sync_server_and_path, port, use_ssl, | 387 service_url.host() + service_url.path(), |
|
haitaol1
2014/08/06 21:30:26
Why don't continue to pass down GURL?
maniscalco
2014/08/06 21:33:40
No reason other than I don't need it any deeper at
| |
| 388 post_factory.release(), cancelation_signal)); | 388 service_url.EffectiveIntPort(), |
| 389 service_url.SchemeIsSecure(), | |
| 390 post_factory.release(), | |
| 391 cancelation_signal)); | |
| 389 connection_manager_->set_client_id(directory()->cache_guid()); | 392 connection_manager_->set_client_id(directory()->cache_guid()); |
| 390 connection_manager_->AddListener(this); | 393 connection_manager_->AddListener(this); |
| 391 | 394 |
| 392 std::string sync_id = directory()->cache_guid(); | 395 std::string sync_id = directory()->cache_guid(); |
| 393 | 396 |
| 394 DVLOG(1) << "Setting sync client ID: " << sync_id; | 397 DVLOG(1) << "Setting sync client ID: " << sync_id; |
| 395 allstatus_.SetSyncId(sync_id); | 398 allstatus_.SetSyncId(sync_id); |
| 396 DVLOG(1) << "Setting invalidator client ID: " << invalidator_client_id; | 399 DVLOG(1) << "Setting invalidator client ID: " << invalidator_client_id; |
| 397 allstatus_.SetInvalidatorClientId(invalidator_client_id); | 400 allstatus_.SetInvalidatorClientId(invalidator_client_id); |
| 398 | 401 |
| (...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1147 int SyncManagerImpl::GetDefaultNudgeDelay() { | 1150 int SyncManagerImpl::GetDefaultNudgeDelay() { |
| 1148 return kDefaultNudgeDelayMilliseconds; | 1151 return kDefaultNudgeDelayMilliseconds; |
| 1149 } | 1152 } |
| 1150 | 1153 |
| 1151 // static. | 1154 // static. |
| 1152 int SyncManagerImpl::GetPreferencesNudgeDelay() { | 1155 int SyncManagerImpl::GetPreferencesNudgeDelay() { |
| 1153 return kPreferencesNudgeDelayMilliseconds; | 1156 return kPreferencesNudgeDelayMilliseconds; |
| 1154 } | 1157 } |
| 1155 | 1158 |
| 1156 } // namespace syncer | 1159 } // namespace syncer |
| OLD | NEW |