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 0d55417a7a8f36bf6aac3f4d3fd2dd1e03bd0ddf..60be1ab51d7d8e57f4dd58c4d5988d954f223fa6 100644 |
--- a/chrome/browser/gcm/gcm_profile_service_factory.cc |
+++ b/chrome/browser/gcm/gcm_profile_service_factory.cc |
@@ -15,6 +15,7 @@ |
#include "chrome/browser/signin/signin_manager_factory.h" |
#include "components/gcm_driver/gcm_profile_service.h" |
#include "components/keyed_service/content/browser_context_dependency_manager.h" |
+#include "components/offline_pages/features/features.h" |
#include "components/signin/core/browser/profile_identity_provider.h" |
#include "components/signin/core/browser/signin_manager.h" |
#include "content/public/browser/browser_thread.h" |
@@ -26,6 +27,11 @@ |
#include "components/gcm_driver/gcm_client_factory.h" |
#endif |
+#if BUILDFLAG(ENABLE_OFFLINE_PAGES) |
+#include "chrome/browser/offline_pages/prefetch/prefetch_service_factory.h" |
+#include "components/offline_pages/core/prefetch/prefetch_gcm_app_handler.h" |
+#endif |
+ |
namespace gcm { |
// static |
@@ -53,6 +59,9 @@ GCMProfileServiceFactory::GCMProfileServiceFactory() |
#if !defined(OS_ANDROID) |
DependsOn(LoginUIServiceFactory::GetInstance()); |
#endif |
+#if BUILDFLAG(ENABLE_OFFLINE_PAGES) |
+ DependsOn(offline_pages::PrefetchServiceFactory::GetInstance()); |
+#endif // BUILDFLAG(ENABLE_OFFLINE_PAGES) |
} |
GCMProfileServiceFactory::~GCMProfileServiceFactory() { |
@@ -67,10 +76,12 @@ KeyedService* GCMProfileServiceFactory::BuildServiceInstanceFor( |
base::CreateSequencedTaskRunnerWithTraits( |
{base::MayBlock(), base::TaskPriority::BACKGROUND, |
base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN})); |
+ std::unique_ptr<GCMProfileService> service = nullptr; |
#if defined(OS_ANDROID) |
- return new GCMProfileService(profile->GetPath(), blocking_task_runner); |
+ service = base::WrapUnique( |
+ new GCMProfileService(profile->GetPath(), blocking_task_runner)); |
#else |
- return new GCMProfileService( |
+ service = base::WrapUnique(new GCMProfileService( |
profile->GetPrefs(), profile->GetPath(), profile->GetRequestContext(), |
chrome::GetChannel(), |
gcm::GetProductCategoryForSubtypes(profile->GetPrefs()), |
@@ -83,8 +94,15 @@ KeyedService* GCMProfileServiceFactory::BuildServiceInstanceFor( |
content::BrowserThread::UI), |
content::BrowserThread::GetTaskRunnerForThread( |
content::BrowserThread::IO), |
- blocking_task_runner); |
+ blocking_task_runner)); |
#endif |
+#if BUILDFLAG(ENABLE_OFFLINE_PAGES) |
+ offline_pages::PrefetchGCMAppHandler::AddAppHandlerToPrefetchService( |
+ offline_pages::PrefetchServiceFactory::GetForBrowserContext(context), |
+ service.get()); |
+#endif // BUILDFLAG(ENABLE_OFFLINE_PAGES) |
+ |
+ return service.release(); |
} |
content::BrowserContext* GCMProfileServiceFactory::GetBrowserContextToUse( |