Index: chrome/browser/sync/glue/sync_backend_host.cc |
diff --git a/chrome/browser/sync/glue/sync_backend_host.cc b/chrome/browser/sync/glue/sync_backend_host.cc |
index 907b176b7e468225d964532ff43993b96f4abe66..8d250d1e036d40b58d47ffc9ed30791d70a419ed 100644 |
--- a/chrome/browser/sync/glue/sync_backend_host.cc |
+++ b/chrome/browser/sync/glue/sync_backend_host.cc |
@@ -61,6 +61,10 @@ |
#include "sync/protocol/sync.pb.h" |
#include "sync/util/nigori.h" |
+#if defined(ENABLE_MANAGED_USERS) |
+#include "chrome/browser/managed_mode/managed_user_service.h" |
+#endif |
+ |
static const int kSaveChangesIntervalSeconds = 10; |
static const base::FilePath::CharType kSyncDataFolderName[] = |
FILE_PATH_LITERAL("Sync Data"); |
@@ -461,6 +465,12 @@ void SyncBackendHost::Initialize( |
InternalComponentsFactoryImpl::BACKOFF_SHORT_INITIAL_RETRY_OVERRIDE; |
} |
+ bool create_invalidator = true; |
+#if defined(ENABLE_MANAGED_USERS) |
+ if (ManagedUserService::ProfileIsManaged(profile_)) |
+ create_invalidator = false; |
+#endif |
+ |
initialization_state_ = CREATING_SYNC_MANAGER; |
InitCore(DoInitializeOptions( |
sync_thread_.message_loop(), |
@@ -483,7 +493,8 @@ void SyncBackendHost::Initialize( |
new InternalComponentsFactoryImpl(factory_switches), |
unrecoverable_error_handler, |
report_unrecoverable_error_function, |
- !cl->HasSwitch(switches::kSyncDisableOAuth2Token))); |
+ !cl->HasSwitch(switches::kSyncDisableOAuth2Token), |
+ create_invalidator)); |
} |
void SyncBackendHost::UpdateCredentials(const SyncCredentials& credentials) { |
@@ -968,7 +979,8 @@ SyncBackendHost::DoInitializeOptions::DoInitializeOptions( |
syncer::UnrecoverableErrorHandler* unrecoverable_error_handler, |
syncer::ReportUnrecoverableErrorFunction |
report_unrecoverable_error_function, |
- bool use_oauth2_token) |
+ bool use_oauth2_token, |
+ bool create_invalidator) |
: sync_loop(sync_loop), |
registrar(registrar), |
routing_info(routing_info), |
@@ -989,7 +1001,8 @@ SyncBackendHost::DoInitializeOptions::DoInitializeOptions( |
unrecoverable_error_handler(unrecoverable_error_handler), |
report_unrecoverable_error_function( |
report_unrecoverable_error_function), |
- use_oauth2_token(use_oauth2_token) { |
+ use_oauth2_token(use_oauth2_token), |
+ create_invalidator(create_invalidator) { |
} |
SyncBackendHost::DoInitializeOptions::~DoInitializeOptions() {} |
@@ -1240,34 +1253,35 @@ void SyncBackendHost::Core::DoInitialize(const DoInitializeOptions& options) { |
sync_manager_ = options.sync_manager_factory->CreateSyncManager(name_); |
sync_manager_->AddObserver(this); |
- sync_manager_->Init( |
- sync_data_folder_path_, |
- options.event_handler, |
- options.service_url.host() + options.service_url.path(), |
- options.service_url.EffectiveIntPort(), |
- options.service_url.SchemeIsSecure(), |
- options.make_http_bridge_factory_fn.Run().Pass(), |
- options.workers, |
- options.extensions_activity_monitor, |
- options.registrar /* as SyncManager::ChangeDelegate */, |
- options.credentials, |
+ scoped_ptr<syncer::Invalidator> invalidator; |
+ if (options.create_invalidator) { |
rlarocque
2013/06/18 20:05:13
I think this is the wrong approach.
You probabl
Bernhard Bauer
2013/06/18 20:59:22
Yes, that's what I ended up doing.
|
#if defined(OS_ANDROID) |
- scoped_ptr<syncer::Invalidator>( |
- new AndroidInvalidatorBridgeProxy( |
- options.android_invalidator_bridge)), |
+ invalidator.reset( |
+ new AndroidInvalidatorBridgeProxy(options.android_invalidator_bridge)); |
#else |
- scoped_ptr<syncer::Invalidator>( |
- options.invalidator_factory->CreateInvalidator()), |
+ invalidator.reset(options.invalidator_factory->CreateInvalidator()); |
#endif |
- options.invalidator_factory->GetInvalidatorClientId(), |
- options.restored_key_for_bootstrapping, |
- options.restored_keystore_key_for_bootstrapping, |
- scoped_ptr<InternalComponentsFactory>( |
- options.internal_components_factory), |
- &encryptor_, |
- options.unrecoverable_error_handler, |
- options.report_unrecoverable_error_function, |
- options.use_oauth2_token); |
+ } |
+ sync_manager_->Init(sync_data_folder_path_, |
+ options.event_handler, |
+ options.service_url.host() + options.service_url.path(), |
+ options.service_url.EffectiveIntPort(), |
+ options.service_url.SchemeIsSecure(), |
+ options.make_http_bridge_factory_fn.Run().Pass(), |
+ options.workers, |
+ options.extensions_activity_monitor, |
+ options.registrar /* as SyncManager::ChangeDelegate */, |
+ options.credentials, |
+ invalidator.Pass(), |
pavely
2013/06/18 17:31:55
I thought about this, but found that SyncManagerIm
pavely
2013/06/18 17:44:14
I just chatted with Tim. Better approach would be
rlarocque
2013/06/18 20:05:13
Maybe the state should be TRANSIENT_ERROR, since t
Bernhard Bauer
2013/06/18 20:59:22
Done.
|
+ options.invalidator_factory->GetInvalidatorClientId(), |
+ options.restored_key_for_bootstrapping, |
+ options.restored_keystore_key_for_bootstrapping, |
+ scoped_ptr<InternalComponentsFactory>( |
+ options.internal_components_factory), |
+ &encryptor_, |
+ options.unrecoverable_error_handler, |
+ options.report_unrecoverable_error_function, |
+ options.use_oauth2_token); |
// |sync_manager_| may end up being NULL here in tests (in |
// synchronous initialization mode). |