| 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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 CHECK(sync_prefs_.get()); | 347 CHECK(sync_prefs_.get()); |
| 348 if (sync_prefs_->HasSyncSetupCompleted()) { | 348 if (sync_prefs_->HasSyncSetupCompleted()) { |
| 349 initial_types_with_nigori.Put(syncable::NIGORI); | 349 initial_types_with_nigori.Put(syncable::NIGORI); |
| 350 } | 350 } |
| 351 | 351 |
| 352 registrar_.reset(new SyncBackendRegistrar(initial_types_with_nigori, | 352 registrar_.reset(new SyncBackendRegistrar(initial_types_with_nigori, |
| 353 name_, | 353 name_, |
| 354 profile_, | 354 profile_, |
| 355 sync_thread_.message_loop())); | 355 sync_thread_.message_loop())); |
| 356 initialization_state_ = CREATING_SYNC_MANAGER; | 356 initialization_state_ = CREATING_SYNC_MANAGER; |
| 357 std::string bootstrap_token = sync_prefs_->GetEncryptionBootstrapToken(); |
| 358 if (bootstrap_token.empty()) |
| 359 bootstrap_token = sync_prefs_->GetSpareBootstrapToken(); |
| 360 |
| 357 InitCore(DoInitializeOptions( | 361 InitCore(DoInitializeOptions( |
| 358 sync_thread_.message_loop(), | 362 sync_thread_.message_loop(), |
| 359 registrar_.get(), | 363 registrar_.get(), |
| 360 &extensions_activity_monitor_, | 364 &extensions_activity_monitor_, |
| 361 event_handler, | 365 event_handler, |
| 362 sync_service_url, | 366 sync_service_url, |
| 363 base::Bind(&MakeHttpBridgeFactory, | 367 base::Bind(&MakeHttpBridgeFactory, |
| 364 make_scoped_refptr(profile_->GetRequestContext())), | 368 make_scoped_refptr(profile_->GetRequestContext())), |
| 365 credentials, | 369 credentials, |
| 366 &chrome_sync_notification_bridge_, | 370 &chrome_sync_notification_bridge_, |
| 367 &sync_notifier_factory_, | 371 &sync_notifier_factory_, |
| 368 delete_sync_data_folder, | 372 delete_sync_data_folder, |
| 369 sync_prefs_->GetEncryptionBootstrapToken(), | 373 bootstrap_token, |
| 370 sync_api::SyncManager::NON_TEST, | 374 sync_api::SyncManager::NON_TEST, |
| 371 unrecoverable_error_handler, | 375 unrecoverable_error_handler, |
| 372 report_unrecoverable_error_function)); | 376 report_unrecoverable_error_function)); |
| 373 } | 377 } |
| 374 | 378 |
| 375 void SyncBackendHost::UpdateCredentials(const SyncCredentials& credentials) { | 379 void SyncBackendHost::UpdateCredentials(const SyncCredentials& credentials) { |
| 376 sync_thread_.message_loop()->PostTask(FROM_HERE, | 380 sync_thread_.message_loop()->PostTask(FROM_HERE, |
| 377 base::Bind(&SyncBackendHost::Core::DoUpdateCredentials, core_.get(), | 381 base::Bind(&SyncBackendHost::Core::DoUpdateCredentials, core_.get(), |
| 378 credentials)); | 382 credentials)); |
| 379 } | 383 } |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 913 if (!sync_loop_) | 917 if (!sync_loop_) |
| 914 return; | 918 return; |
| 915 DCHECK_EQ(MessageLoop::current(), sync_loop_); | 919 DCHECK_EQ(MessageLoop::current(), sync_loop_); |
| 916 host_.Call( | 920 host_.Call( |
| 917 FROM_HERE, | 921 FROM_HERE, |
| 918 &SyncBackendHost::NotifyPassphraseAccepted); | 922 &SyncBackendHost::NotifyPassphraseAccepted); |
| 919 } | 923 } |
| 920 | 924 |
| 921 void SyncBackendHost::Core::OnBootstrapTokenUpdated( | 925 void SyncBackendHost::Core::OnBootstrapTokenUpdated( |
| 922 const std::string& bootstrap_token) { | 926 const std::string& bootstrap_token) { |
| 927 LOG(WARNING) << "OnBootstrapTokenUpdated : " << bootstrap_token; |
| 923 if (!sync_loop_) | 928 if (!sync_loop_) |
| 924 return; | 929 return; |
| 925 DCHECK_EQ(MessageLoop::current(), sync_loop_); | 930 DCHECK_EQ(MessageLoop::current(), sync_loop_); |
| 926 host_.Call( | 931 host_.Call( |
| 927 FROM_HERE, | 932 FROM_HERE, |
| 928 &SyncBackendHost::PersistEncryptionBootstrapToken, bootstrap_token); | 933 &SyncBackendHost::PersistEncryptionBootstrapToken, bootstrap_token); |
| 929 } | 934 } |
| 930 | 935 |
| 931 void SyncBackendHost::Core::OnStopSyncingPermanently() { | 936 void SyncBackendHost::Core::OnStopSyncingPermanently() { |
| 932 if (!sync_loop_) | 937 if (!sync_loop_) |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1422 FROM_HERE, | 1427 FROM_HERE, |
| 1423 base::Bind(&SyncBackendHost::Core::DoRefreshNigori, | 1428 base::Bind(&SyncBackendHost::Core::DoRefreshNigori, |
| 1424 core_.get(), sync_thread_done_callback)); | 1429 core_.get(), sync_thread_done_callback)); |
| 1425 } | 1430 } |
| 1426 | 1431 |
| 1427 #undef SDVLOG | 1432 #undef SDVLOG |
| 1428 | 1433 |
| 1429 #undef SLOG | 1434 #undef SLOG |
| 1430 | 1435 |
| 1431 } // namespace browser_sync | 1436 } // namespace browser_sync |
| OLD | NEW |