Index: chrome/browser/android/offline_pages/prefetch/prefetch_service_factory.cc |
diff --git a/components/offline_pages/content/prefetch_service_factory.cc b/chrome/browser/android/offline_pages/prefetch/prefetch_service_factory.cc |
similarity index 57% |
rename from components/offline_pages/content/prefetch_service_factory.cc |
rename to chrome/browser/android/offline_pages/prefetch/prefetch_service_factory.cc |
index ffe46b2630825585089479fcd31dfa4165481b54..f181cb8b1d4ffb876c8fa1b6b529b8711629a79b 100644 |
--- a/components/offline_pages/content/prefetch_service_factory.cc |
+++ b/chrome/browser/android/offline_pages/prefetch/prefetch_service_factory.cc |
@@ -2,19 +2,29 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "components/offline_pages/content/prefetch_service_factory.h" |
+#include "chrome/browser/android/offline_pages/prefetch/prefetch_service_factory.h" |
#include "base/memory/singleton.h" |
+#include "chrome/browser/gcm/gcm_profile_service_factory.h" |
+#include "components/gcm_driver/gcm_driver.h" |
+#include "components/gcm_driver/gcm_profile_service.h" |
#include "components/keyed_service/content/browser_context_dependency_manager.h" |
#include "components/offline_pages/core/prefetch/prefetch_service_impl.h" |
#include "content/public/browser/browser_context.h" |
namespace offline_pages { |
+namespace { |
+const char kPrefetchingOfflinePagesAppId[] = |
+ "com.google.chrome.OfflinePagePrefetch"; |
+} |
+ |
PrefetchServiceFactory::PrefetchServiceFactory() |
: BrowserContextKeyedServiceFactory( |
"OfflinePagePrefetchService", |
- BrowserContextDependencyManager::GetInstance()) {} |
+ BrowserContextDependencyManager::GetInstance()) { |
+ DependsOn(gcm::GCMProfileServiceFactory::GetInstance()); |
Dmitry Titov
2017/05/09 00:22:25
I wonder if this is the other way around - technic
|
+} |
// static |
PrefetchServiceFactory* PrefetchServiceFactory::GetInstance() { |
@@ -30,7 +40,15 @@ PrefetchService* PrefetchServiceFactory::GetForBrowserContext( |
KeyedService* PrefetchServiceFactory::BuildServiceInstanceFor( |
content::BrowserContext* context) const { |
- return new PrefetchServiceImpl(); |
+ PrefetchServiceImpl* service = new PrefetchServiceImpl(); |
+ gcm::GCMProfileServiceFactory::GetForProfile(context) |
+ ->driver() |
+ ->AddAppHandler(kPrefetchingOfflinePagesAppId, service); |
+ return service; |
+} |
+ |
+bool PrefetchServiceFactory::ServiceIsCreatedWithBrowserContext() const { |
+ return true; |
} |
} // namespace offline_pages |