| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/sync/glue/sync_backend_host_impl.h" | 5 #include "chrome/browser/sync/glue/sync_backend_host_impl.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/signin/chrome_signin_client_factory.h" | |
| 13 #include "chrome/browser/sync/glue/sync_backend_host_core.h" | 12 #include "chrome/browser/sync/glue/sync_backend_host_core.h" |
| 14 #include "chrome/browser/sync/glue/sync_backend_registrar.h" | 13 #include "chrome/browser/sync/glue/sync_backend_registrar.h" |
| 15 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
| 16 #include "components/invalidation/invalidation_service.h" | 15 #include "components/invalidation/invalidation_service.h" |
| 17 #include "components/invalidation/object_id_invalidation_map.h" | 16 #include "components/invalidation/object_id_invalidation_map.h" |
| 18 #include "components/network_time/network_time_tracker.h" | 17 #include "components/network_time/network_time_tracker.h" |
| 19 #include "components/signin/core/browser/signin_client.h" | |
| 20 #include "components/sync_driver/sync_frontend.h" | 18 #include "components/sync_driver/sync_frontend.h" |
| 21 #include "components/sync_driver/sync_prefs.h" | 19 #include "components/sync_driver/sync_prefs.h" |
| 22 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
| 23 #include "content/public/browser/notification_details.h" | 21 #include "content/public/browser/notification_details.h" |
| 24 #include "content/public/browser/notification_source.h" | 22 #include "content/public/browser/notification_source.h" |
| 25 #include "sync/internal_api/public/base_transaction.h" | 23 #include "sync/internal_api/public/base_transaction.h" |
| 26 #include "sync/internal_api/public/events/protocol_event.h" | 24 #include "sync/internal_api/public/events/protocol_event.h" |
| 27 #include "sync/internal_api/public/http_bridge.h" | 25 #include "sync/internal_api/public/http_bridge.h" |
| 28 #include "sync/internal_api/public/internal_components_factory.h" | 26 #include "sync/internal_api/public/internal_components_factory.h" |
| 29 #include "sync/internal_api/public/internal_components_factory_impl.h" | 27 #include "sync/internal_api/public/internal_components_factory_impl.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 CommandLine* cl = CommandLine::ForCurrentProcess(); | 125 CommandLine* cl = CommandLine::ForCurrentProcess(); |
| 128 if (cl->HasSwitch(switches::kSyncShortInitialRetryOverride)) { | 126 if (cl->HasSwitch(switches::kSyncShortInitialRetryOverride)) { |
| 129 factory_switches.backoff_override = | 127 factory_switches.backoff_override = |
| 130 InternalComponentsFactory::BACKOFF_SHORT_INITIAL_RETRY_OVERRIDE; | 128 InternalComponentsFactory::BACKOFF_SHORT_INITIAL_RETRY_OVERRIDE; |
| 131 } | 129 } |
| 132 if (cl->HasSwitch(switches::kSyncEnableGetUpdateAvoidance)) { | 130 if (cl->HasSwitch(switches::kSyncEnableGetUpdateAvoidance)) { |
| 133 factory_switches.pre_commit_updates_policy = | 131 factory_switches.pre_commit_updates_policy = |
| 134 InternalComponentsFactory::FORCE_ENABLE_PRE_COMMIT_UPDATE_AVOIDANCE; | 132 InternalComponentsFactory::FORCE_ENABLE_PRE_COMMIT_UPDATE_AVOIDANCE; |
| 135 } | 133 } |
| 136 | 134 |
| 137 SigninClient* signin_client = | |
| 138 ChromeSigninClientFactory::GetForProfile(profile_); | |
| 139 DCHECK(signin_client); | |
| 140 std::string signin_scoped_device_id = | |
| 141 signin_client->GetSigninScopedDeviceId(); | |
| 142 | |
| 143 scoped_ptr<DoInitializeOptions> init_opts(new DoInitializeOptions( | 135 scoped_ptr<DoInitializeOptions> init_opts(new DoInitializeOptions( |
| 144 registrar_->sync_thread()->message_loop(), | 136 registrar_->sync_thread()->message_loop(), |
| 145 registrar_.get(), | 137 registrar_.get(), |
| 146 routing_info, | 138 routing_info, |
| 147 workers, | 139 workers, |
| 148 extensions_activity_monitor_.GetExtensionsActivity(), | 140 extensions_activity_monitor_.GetExtensionsActivity(), |
| 149 event_handler, | 141 event_handler, |
| 150 sync_service_url, | 142 sync_service_url, |
| 151 network_resources->GetHttpPostProviderFactory( | 143 network_resources->GetHttpPostProviderFactory( |
| 152 make_scoped_refptr(profile_->GetRequestContext()), | 144 make_scoped_refptr(profile_->GetRequestContext()), |
| 153 base::Bind(&UpdateNetworkTime), | 145 base::Bind(&UpdateNetworkTime), |
| 154 core_->GetRequestContextCancelationSignal()), | 146 core_->GetRequestContextCancelationSignal()), |
| 155 credentials, | 147 credentials, |
| 156 invalidator_ ? invalidator_->GetInvalidatorClientId() : "", | 148 invalidator_ ? invalidator_->GetInvalidatorClientId() : "", |
| 157 sync_manager_factory.Pass(), | 149 sync_manager_factory.Pass(), |
| 158 delete_sync_data_folder, | 150 delete_sync_data_folder, |
| 159 sync_prefs_->GetEncryptionBootstrapToken(), | 151 sync_prefs_->GetEncryptionBootstrapToken(), |
| 160 sync_prefs_->GetKeystoreEncryptionBootstrapToken(), | 152 sync_prefs_->GetKeystoreEncryptionBootstrapToken(), |
| 161 scoped_ptr<InternalComponentsFactory>( | 153 scoped_ptr<InternalComponentsFactory>( |
| 162 new syncer::InternalComponentsFactoryImpl(factory_switches)).Pass(), | 154 new syncer::InternalComponentsFactoryImpl(factory_switches)).Pass(), |
| 163 unrecoverable_error_handler.Pass(), | 155 unrecoverable_error_handler.Pass(), |
| 164 report_unrecoverable_error_function, | 156 report_unrecoverable_error_function)); |
| 165 signin_scoped_device_id)); | |
| 166 InitCore(init_opts.Pass()); | 157 InitCore(init_opts.Pass()); |
| 167 } | 158 } |
| 168 | 159 |
| 169 void SyncBackendHostImpl::UpdateCredentials( | 160 void SyncBackendHostImpl::UpdateCredentials( |
| 170 const syncer::SyncCredentials& credentials) { | 161 const syncer::SyncCredentials& credentials) { |
| 171 DCHECK(registrar_->sync_thread()->IsRunning()); | 162 DCHECK(registrar_->sync_thread()->IsRunning()); |
| 172 registrar_->sync_thread()->message_loop()->PostTask(FROM_HERE, | 163 registrar_->sync_thread()->message_loop()->PostTask(FROM_HERE, |
| 173 base::Bind(&SyncBackendHostCore::DoUpdateCredentials, | 164 base::Bind(&SyncBackendHostCore::DoUpdateCredentials, |
| 174 core_.get(), | 165 core_.get(), |
| 175 credentials)); | 166 credentials)); |
| (...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 885 | 876 |
| 886 base::MessageLoop* SyncBackendHostImpl::GetSyncLoopForTesting() { | 877 base::MessageLoop* SyncBackendHostImpl::GetSyncLoopForTesting() { |
| 887 return registrar_->sync_thread()->message_loop(); | 878 return registrar_->sync_thread()->message_loop(); |
| 888 } | 879 } |
| 889 | 880 |
| 890 } // namespace browser_sync | 881 } // namespace browser_sync |
| 891 | 882 |
| 892 #undef SDVLOG | 883 #undef SDVLOG |
| 893 | 884 |
| 894 #undef SLOG | 885 #undef SLOG |
| OLD | NEW |