Chromium Code Reviews| Index: chrome/browser/gcm/gcm_profile_service_factory.cc |
| diff --git a/chrome/browser/gcm/gcm_profile_service_factory.cc b/chrome/browser/gcm/gcm_profile_service_factory.cc |
| index f46cd612f8231fe2083b041e28d05da76a770eb6..45e4913e3cb522fe0684c763b4daf88ccde7bcde 100644 |
| --- a/chrome/browser/gcm/gcm_profile_service_factory.cc |
| +++ b/chrome/browser/gcm/gcm_profile_service_factory.cc |
| @@ -18,7 +18,10 @@ |
| #include "components/signin/core/browser/signin_manager.h" |
| #include "content/public/browser/browser_thread.h" |
| -#if !defined(OS_ANDROID) |
| +#if defined(OS_ANDROID) |
| +#include "components/offline_pages/content/prefetch_service_factory.h" |
| +#include "components/offline_pages/core/prefetch/prefetch_service.h" |
| +#else |
| #include "chrome/browser/gcm/gcm_product_util.h" |
| #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
| #include "chrome/common/channel_info.h" |
| @@ -51,6 +54,8 @@ GCMProfileServiceFactory::GCMProfileServiceFactory() |
| DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance()); |
| #if !defined(OS_ANDROID) |
| DependsOn(LoginUIServiceFactory::GetInstance()); |
| +#else |
| + DependsOn(offline_pages::PrefetchServiceFactory::GetInstance()); |
| #endif |
| } |
| @@ -68,10 +73,16 @@ KeyedService* GCMProfileServiceFactory::BuildServiceInstanceFor( |
| worker_pool->GetSequencedTaskRunnerWithShutdownBehavior( |
| worker_pool->GetSequenceToken(), |
| base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); |
| + std::unique_ptr<GCMProfileService> service; |
| #if defined(OS_ANDROID) |
| - return new GCMProfileService(profile->GetPath(), blocking_task_runner); |
| + service = base::WrapUnique( |
|
Dmitry Titov
2017/05/11 03:35:20
Could be just base::MakeUnique<type>(params);
|
| + new GCMProfileService(profile->GetPath(), blocking_task_runner)); |
| + offline_pages::PrefetchService* prefetch_service = |
| + offline_pages::PrefetchServiceFactory::GetForBrowserContext(context); |
| + if (prefetch_service) |
| + prefetch_service->RegisterWithGCMDriver(service->driver()); |
| #else |
| - return new GCMProfileService( |
| + service = base::WrapUnique(new GCMProfileService( |
| profile->GetPrefs(), profile->GetPath(), profile->GetRequestContext(), |
| chrome::GetChannel(), |
| gcm::GetProductCategoryForSubtypes(profile->GetPrefs()), |
| @@ -84,8 +95,9 @@ KeyedService* GCMProfileServiceFactory::BuildServiceInstanceFor( |
| content::BrowserThread::UI), |
| content::BrowserThread::GetTaskRunnerForThread( |
| content::BrowserThread::IO), |
| - blocking_task_runner); |
| + blocking_task_runner)); |
| #endif |
| + return service.release(); |
| } |
| content::BrowserContext* GCMProfileServiceFactory::GetBrowserContextToUse( |