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