Chromium Code Reviews| Index: chrome/browser/sync/profile_sync_service_factory.cc |
| diff --git a/chrome/browser/sync/profile_sync_service_factory.cc b/chrome/browser/sync/profile_sync_service_factory.cc |
| index 1478dc352e9ed5cff20009ca2bab196ef78cd6f8..afb07358347c8e94d55d56739c96855f1643b8bd 100644 |
| --- a/chrome/browser/sync/profile_sync_service_factory.cc |
| +++ b/chrome/browser/sync/profile_sync_service_factory.cc |
| @@ -25,11 +25,12 @@ |
| #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| #include "chrome/browser/signin/signin_manager_factory.h" |
| #include "chrome/browser/sync/chrome_sync_client.h" |
| -#include "chrome/browser/sync/profile_sync_components_factory_impl.h" |
| #include "chrome/browser/sync/supervised_user_signin_manager_wrapper.h" |
| #include "chrome/browser/themes/theme_service_factory.h" |
| #include "chrome/browser/web_data_service_factory.h" |
| #include "chrome/common/channel_info.h" |
| +#include "chrome/common/pref_names.h" |
| +#include "components/browser_sync/browser/profile_sync_components_factory_impl.h" |
| #include "components/browser_sync/browser/profile_sync_service.h" |
| #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| #include "components/network_time/network_time_tracker.h" |
| @@ -40,6 +41,7 @@ |
| #include "components/sync_driver/sync_util.h" |
| #include "components/variations/variations_associated_data.h" |
| #include "content/public/browser/browser_thread.h" |
| +#include "ui/base/device_form_factor.h" |
| #include "url/gurl.h" |
| #if defined(ENABLE_EXTENSIONS) |
| @@ -163,7 +165,6 @@ KeyedService* ProfileSyncServiceFactory::BuildServiceInstanceFor( |
| scoped_ptr<SigninManagerWrapper> signin_wrapper( |
| new SupervisedUserSigninManagerWrapper(profile, signin)); |
| - std::string account_id = signin_wrapper->GetAccountIdToUse(); |
| OAuth2TokenService::ScopeSet scope_set; |
|
blundell
2015/11/12 10:33:47
it seems like this isn't used either?
Nicolas Zea
2015/11/12 19:07:29
Good catch, done.
|
| scope_set.insert(signin_wrapper->GetSyncScopeToUse()); |
| ProfileOAuth2TokenService* token_service = |
| @@ -180,14 +181,21 @@ KeyedService* ProfileSyncServiceFactory::BuildServiceInstanceFor( |
| browser_sync::ProfileSyncServiceStartBehavior behavior = |
| browser_defaults::kSyncAutoStarts ? browser_sync::AUTO_START |
| : browser_sync::MANUAL_START; |
| - scoped_ptr<sync_driver::SyncApiComponentFactory> sync_factory( |
| + browser_sync::ChromeSyncClient* chrome_sync_client = |
| + new browser_sync::ChromeSyncClient(profile); |
| + sync_driver::SyncApiComponentFactory* sync_factory = |
| new ProfileSyncComponentsFactoryImpl( |
| - profile, base::CommandLine::ForCurrentProcess(), sync_service_url, |
| - token_service, url_request_context_getter)); |
| - scoped_ptr<browser_sync::ChromeSyncClient> sync_client( |
| - new browser_sync::ChromeSyncClient(profile, sync_factory.Pass())); |
| + chrome_sync_client, chrome::GetChannel(), chrome::GetVersionString(), |
| + ui::GetDeviceFormFactor() == ui::DEVICE_FORM_FACTOR_TABLET, |
| + *base::CommandLine::ForCurrentProcess(), |
| + prefs::kSavingBrowserHistoryDisabled, sync_service_url, |
| + content::BrowserThread::GetMessageLoopProxyForThread( |
| + content::BrowserThread::UI), |
| + content::BrowserThread::GetMessageLoopProxyForThread( |
| + content::BrowserThread::DB), |
| + token_service, url_request_context_getter); |
| ProfileSyncService* pss = new ProfileSyncService( |
| - sync_client.Pass(), signin_wrapper.Pass(), token_service, |
| + make_scoped_ptr(chrome_sync_client), signin_wrapper.Pass(), token_service, |
| behavior, base::Bind(&UpdateNetworkTime), profile->GetPath(), |
| profile->GetRequestContext(), profile->GetDebugName(), |
| chrome::GetChannel(), |
| @@ -196,6 +204,10 @@ KeyedService* ProfileSyncServiceFactory::BuildServiceInstanceFor( |
| content::BrowserThread::GetMessageLoopProxyForThread( |
| content::BrowserThread::FILE), |
| content::BrowserThread::GetBlockingPool()); |
| + |
| + // The order in which these are performed matters. The PSS depends on the |
| + // SyncClient being initialized before it can initalize itself. |
| + chrome_sync_client->Initialize(make_scoped_ptr(sync_factory), pss); |
| pss->Initialize(); |
| return pss; |
| } |