| 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/public/sync_manager.h" | 5 #include "sync/internal_api/public/sync_manager.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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 const std::string& sync_server_and_path, | 197 const std::string& sync_server_and_path, |
| 198 int port, | 198 int port, |
| 199 bool use_ssl, | 199 bool use_ssl, |
| 200 const scoped_refptr<base::TaskRunner>& blocking_task_runner, | 200 const scoped_refptr<base::TaskRunner>& blocking_task_runner, |
| 201 HttpPostProviderFactory* post_factory, | 201 HttpPostProviderFactory* post_factory, |
| 202 const csync::ModelSafeRoutingInfo& model_safe_routing_info, | 202 const csync::ModelSafeRoutingInfo& model_safe_routing_info, |
| 203 const std::vector<csync::ModelSafeWorker*>& workers, | 203 const std::vector<csync::ModelSafeWorker*>& workers, |
| 204 csync::ExtensionsActivityMonitor* | 204 csync::ExtensionsActivityMonitor* |
| 205 extensions_activity_monitor, | 205 extensions_activity_monitor, |
| 206 ChangeDelegate* change_delegate, | 206 ChangeDelegate* change_delegate, |
| 207 const std::string& user_agent, | |
| 208 const SyncCredentials& credentials, | 207 const SyncCredentials& credentials, |
| 209 csync::SyncNotifier* sync_notifier, | 208 csync::SyncNotifier* sync_notifier, |
| 210 const std::string& restored_key_for_bootstrapping, | 209 const std::string& restored_key_for_bootstrapping, |
| 211 TestingMode testing_mode, | 210 TestingMode testing_mode, |
| 212 Encryptor* encryptor, | 211 Encryptor* encryptor, |
| 213 UnrecoverableErrorHandler* unrecoverable_error_handler, | 212 UnrecoverableErrorHandler* unrecoverable_error_handler, |
| 214 ReportUnrecoverableErrorFunction | 213 ReportUnrecoverableErrorFunction |
| 215 report_unrecoverable_error_function); | 214 report_unrecoverable_error_function); |
| 216 | 215 |
| 217 // Sign into sync with given credentials. | 216 // Sign into sync with given credentials. |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 const WeakHandle<JsEventHandler>& event_handler, | 712 const WeakHandle<JsEventHandler>& event_handler, |
| 714 const std::string& sync_server_and_path, | 713 const std::string& sync_server_and_path, |
| 715 int sync_server_port, | 714 int sync_server_port, |
| 716 bool use_ssl, | 715 bool use_ssl, |
| 717 const scoped_refptr<base::TaskRunner>& blocking_task_runner, | 716 const scoped_refptr<base::TaskRunner>& blocking_task_runner, |
| 718 HttpPostProviderFactory* post_factory, | 717 HttpPostProviderFactory* post_factory, |
| 719 const csync::ModelSafeRoutingInfo& model_safe_routing_info, | 718 const csync::ModelSafeRoutingInfo& model_safe_routing_info, |
| 720 const std::vector<csync::ModelSafeWorker*>& workers, | 719 const std::vector<csync::ModelSafeWorker*>& workers, |
| 721 csync::ExtensionsActivityMonitor* extensions_activity_monitor, | 720 csync::ExtensionsActivityMonitor* extensions_activity_monitor, |
| 722 ChangeDelegate* change_delegate, | 721 ChangeDelegate* change_delegate, |
| 723 const std::string& user_agent, | |
| 724 const SyncCredentials& credentials, | 722 const SyncCredentials& credentials, |
| 725 csync::SyncNotifier* sync_notifier, | 723 csync::SyncNotifier* sync_notifier, |
| 726 const std::string& restored_key_for_bootstrapping, | 724 const std::string& restored_key_for_bootstrapping, |
| 727 TestingMode testing_mode, | 725 TestingMode testing_mode, |
| 728 Encryptor* encryptor, | 726 Encryptor* encryptor, |
| 729 UnrecoverableErrorHandler* unrecoverable_error_handler, | 727 UnrecoverableErrorHandler* unrecoverable_error_handler, |
| 730 ReportUnrecoverableErrorFunction report_unrecoverable_error_function) { | 728 ReportUnrecoverableErrorFunction report_unrecoverable_error_function) { |
| 731 DCHECK(thread_checker_.CalledOnValidThread()); | 729 DCHECK(thread_checker_.CalledOnValidThread()); |
| 732 DCHECK(post_factory); | 730 DCHECK(post_factory); |
| 733 DVLOG(1) << "SyncManager starting Init..."; | 731 DVLOG(1) << "SyncManager starting Init..."; |
| 734 std::string server_string(sync_server_and_path); | 732 std::string server_string(sync_server_and_path); |
| 735 return data_->Init(database_location, | 733 return data_->Init(database_location, |
| 736 event_handler, | 734 event_handler, |
| 737 server_string, | 735 server_string, |
| 738 sync_server_port, | 736 sync_server_port, |
| 739 use_ssl, | 737 use_ssl, |
| 740 blocking_task_runner, | 738 blocking_task_runner, |
| 741 post_factory, | 739 post_factory, |
| 742 model_safe_routing_info, | 740 model_safe_routing_info, |
| 743 workers, | 741 workers, |
| 744 extensions_activity_monitor, | 742 extensions_activity_monitor, |
| 745 change_delegate, | 743 change_delegate, |
| 746 user_agent, | |
| 747 credentials, | 744 credentials, |
| 748 sync_notifier, | 745 sync_notifier, |
| 749 restored_key_for_bootstrapping, | 746 restored_key_for_bootstrapping, |
| 750 testing_mode, | 747 testing_mode, |
| 751 encryptor, | 748 encryptor, |
| 752 unrecoverable_error_handler, | 749 unrecoverable_error_handler, |
| 753 report_unrecoverable_error_function); | 750 report_unrecoverable_error_function); |
| 754 } | 751 } |
| 755 | 752 |
| 756 void SyncManager::UpdateCredentials(const SyncCredentials& credentials) { | 753 void SyncManager::UpdateCredentials(const SyncCredentials& credentials) { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 const WeakHandle<JsEventHandler>& event_handler, | 856 const WeakHandle<JsEventHandler>& event_handler, |
| 860 const std::string& sync_server_and_path, | 857 const std::string& sync_server_and_path, |
| 861 int port, | 858 int port, |
| 862 bool use_ssl, | 859 bool use_ssl, |
| 863 const scoped_refptr<base::TaskRunner>& blocking_task_runner, | 860 const scoped_refptr<base::TaskRunner>& blocking_task_runner, |
| 864 HttpPostProviderFactory* post_factory, | 861 HttpPostProviderFactory* post_factory, |
| 865 const csync::ModelSafeRoutingInfo& model_safe_routing_info, | 862 const csync::ModelSafeRoutingInfo& model_safe_routing_info, |
| 866 const std::vector<csync::ModelSafeWorker*>& workers, | 863 const std::vector<csync::ModelSafeWorker*>& workers, |
| 867 csync::ExtensionsActivityMonitor* extensions_activity_monitor, | 864 csync::ExtensionsActivityMonitor* extensions_activity_monitor, |
| 868 ChangeDelegate* change_delegate, | 865 ChangeDelegate* change_delegate, |
| 869 const std::string& user_agent, | |
| 870 const SyncCredentials& credentials, | 866 const SyncCredentials& credentials, |
| 871 csync::SyncNotifier* sync_notifier, | 867 csync::SyncNotifier* sync_notifier, |
| 872 const std::string& restored_key_for_bootstrapping, | 868 const std::string& restored_key_for_bootstrapping, |
| 873 TestingMode testing_mode, | 869 TestingMode testing_mode, |
| 874 Encryptor* encryptor, | 870 Encryptor* encryptor, |
| 875 UnrecoverableErrorHandler* unrecoverable_error_handler, | 871 UnrecoverableErrorHandler* unrecoverable_error_handler, |
| 876 ReportUnrecoverableErrorFunction report_unrecoverable_error_function) { | 872 ReportUnrecoverableErrorFunction report_unrecoverable_error_function) { |
| 877 CHECK(!initialized_); | 873 CHECK(!initialized_); |
| 878 | 874 |
| 879 DCHECK(thread_checker_.CalledOnValidThread()); | 875 DCHECK(thread_checker_.CalledOnValidThread()); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 898 syncable::Directory::kSyncDatabaseFilename); | 894 syncable::Directory::kSyncDatabaseFilename); |
| 899 encryptor_ = encryptor; | 895 encryptor_ = encryptor; |
| 900 unrecoverable_error_handler_ = unrecoverable_error_handler; | 896 unrecoverable_error_handler_ = unrecoverable_error_handler; |
| 901 report_unrecoverable_error_function_ = report_unrecoverable_error_function; | 897 report_unrecoverable_error_function_ = report_unrecoverable_error_function; |
| 902 share_.directory.reset( | 898 share_.directory.reset( |
| 903 new syncable::Directory(encryptor_, | 899 new syncable::Directory(encryptor_, |
| 904 unrecoverable_error_handler_, | 900 unrecoverable_error_handler_, |
| 905 report_unrecoverable_error_function_)); | 901 report_unrecoverable_error_function_)); |
| 906 | 902 |
| 907 connection_manager_.reset(new SyncAPIServerConnectionManager( | 903 connection_manager_.reset(new SyncAPIServerConnectionManager( |
| 908 sync_server_and_path, port, use_ssl, user_agent, post_factory)); | 904 sync_server_and_path, port, use_ssl, post_factory)); |
| 909 | 905 |
| 910 net::NetworkChangeNotifier::AddIPAddressObserver(this); | 906 net::NetworkChangeNotifier::AddIPAddressObserver(this); |
| 911 observing_ip_address_changes_ = true; | 907 observing_ip_address_changes_ = true; |
| 912 | 908 |
| 913 connection_manager()->AddListener(this); | 909 connection_manager()->AddListener(this); |
| 914 | 910 |
| 915 // Test mode does not use a syncer context or syncer thread. | 911 // Test mode does not use a syncer context or syncer thread. |
| 916 if (testing_mode_ == NON_TEST) { | 912 if (testing_mode_ == NON_TEST) { |
| 917 // Build a SyncSessionContext and store the worker in it. | 913 // Build a SyncSessionContext and store the worker in it. |
| 918 DVLOG(1) << "Sync is bringing up SyncSessionContext."; | 914 DVLOG(1) << "Sync is bringing up SyncSessionContext."; |
| (...skipping 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2486 share->directory->GetDownloadProgress(i.Get(), &marker); | 2482 share->directory->GetDownloadProgress(i.Get(), &marker); |
| 2487 | 2483 |
| 2488 if (marker.token().empty()) | 2484 if (marker.token().empty()) |
| 2489 result.Put(i.Get()); | 2485 result.Put(i.Get()); |
| 2490 | 2486 |
| 2491 } | 2487 } |
| 2492 return result; | 2488 return result; |
| 2493 } | 2489 } |
| 2494 | 2490 |
| 2495 } // namespace csync | 2491 } // namespace csync |
| OLD | NEW |