Chromium Code Reviews| Index: chrome/browser/sync/profile_sync_service.cc |
| diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc |
| index 48369fa8d69c16b2c42e2707a6e02664e0909d39..68eb70d237af48c0af6cb97a9a403b38eb5e8f8e 100644 |
| --- a/chrome/browser/sync/profile_sync_service.cc |
| +++ b/chrome/browser/sync/profile_sync_service.cc |
| @@ -24,7 +24,9 @@ |
| #include "base/strings/stringprintf.h" |
| #include "base/thread_task_runner_handle.h" |
| #include "base/threading/thread_restrictions.h" |
| +#include "base/time/time.h" |
| #include "build/build_config.h" |
| +#include "chrome/browser/browser_process.h" |
| #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| #include "chrome/browser/chrome_notification_types.h" |
| #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" |
| @@ -49,6 +51,7 @@ |
| #include "components/history/core/browser/typed_url_data_type_controller.h" |
| #include "components/invalidation/impl/profile_invalidation_provider.h" |
| #include "components/invalidation/public/invalidation_service.h" |
| +#include "components/network_time/network_time_tracker.h" |
| #include "components/password_manager/core/browser/password_store.h" |
| #include "components/pref_registry/pref_registry_syncable.h" |
| #include "components/signin/core/browser/about_signin_internals.h" |
| @@ -188,6 +191,24 @@ void DeleteSyncDataFolder(const base::FilePath& directory_path) { |
| } |
| } |
| +void UpdateNetworkTimeOnUIThread(base::Time network_time, |
|
Nicolas Zea
2015/10/27 20:41:42
Were you planning to try to move this to the PSSFa
maxbogue
2015/10/27 23:53:08
Done.
|
| + base::TimeDelta resolution, |
| + base::TimeDelta latency, |
| + base::TimeTicks post_time) { |
| + g_browser_process->network_time_tracker()->UpdateNetworkTime( |
| + network_time, resolution, latency, post_time); |
| +} |
| + |
| +void UpdateNetworkTime( |
| + const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread, |
| + const base::Time& network_time, |
| + const base::TimeDelta& resolution, |
| + const base::TimeDelta& latency) { |
| + ui_thread->PostTask(FROM_HERE, |
| + base::Bind(&UpdateNetworkTimeOnUIThread, network_time, |
| + resolution, latency, base::TimeTicks::Now())); |
| +} |
| + |
| } // anonymous namespace |
| bool ShouldShowActionOnUI( |
| @@ -527,27 +548,33 @@ void ProfileSyncService::InitializeBackend(bool delete_stale_data) { |
| SyncCredentials credentials = GetCredentials(); |
| - scoped_refptr<net::URLRequestContextGetter> request_context_getter( |
| - profile_->GetRequestContext()); |
| - |
| if (backend_mode_ == SYNC && delete_stale_data) |
| ClearStaleErrors(); |
| - backend_->Initialize(this, sync_thread_.Pass(), |
| - content::BrowserThread::GetMessageLoopProxyForThread( |
| - content::BrowserThread::DB), |
| - content::BrowserThread::GetMessageLoopProxyForThread( |
| - content::BrowserThread::FILE), |
| - GetJsEventHandler(), sync_service_url_, |
| - local_device_->GetSyncUserAgent(), credentials, |
| - delete_stale_data, |
| - scoped_ptr<syncer::SyncManagerFactory>( |
| - new syncer::SyncManagerFactory(GetManagerType())) |
| - .Pass(), |
| - MakeWeakHandle(weak_factory_.GetWeakPtr()), |
| - base::Bind(browser_sync::ChromeReportUnrecoverableError, |
| - chrome::GetChannel()), |
| - network_resources_.get(), saved_nigori_state_.Pass()); |
| + SyncBackendHost::HttpPostProviderFactoryGetter |
| + get_http_post_provider_factory = base::Bind( |
| + &syncer::NetworkResources::GetHttpPostProviderFactory, |
| + base::Unretained(network_resources_.get()), |
| + make_scoped_refptr(profile_->GetRequestContext()), |
| + base::Bind(&UpdateNetworkTime, |
| + content::BrowserThread::GetMessageLoopProxyForThread( |
| + content::BrowserThread::UI))); |
| + |
| + backend_->Initialize( |
| + this, sync_thread_.Pass(), |
| + content::BrowserThread::GetMessageLoopProxyForThread( |
| + content::BrowserThread::DB), |
| + content::BrowserThread::GetMessageLoopProxyForThread( |
| + content::BrowserThread::FILE), |
| + GetJsEventHandler(), sync_service_url_, local_device_->GetSyncUserAgent(), |
| + credentials, delete_stale_data, |
| + scoped_ptr<syncer::SyncManagerFactory>( |
| + new syncer::SyncManagerFactory(GetManagerType())) |
| + .Pass(), |
| + MakeWeakHandle(weak_factory_.GetWeakPtr()), |
| + base::Bind(browser_sync::ChromeReportUnrecoverableError, |
| + chrome::GetChannel()), |
| + get_http_post_provider_factory, saved_nigori_state_.Pass()); |
| } |
| bool ProfileSyncService::IsEncryptedDatatypeEnabled() const { |