Index: chrome/browser/push_messaging/push_messaging_service_factory.cc |
diff --git a/chrome/browser/push_messaging/push_messaging_service_factory.cc b/chrome/browser/push_messaging/push_messaging_service_factory.cc |
index 24d667dbb78eb69338eeae8edaadc1d5ab6e7e34..6688825e5d703f93a4c8bf59876a4de9908f4ee2 100644 |
--- a/chrome/browser/push_messaging/push_messaging_service_factory.cc |
+++ b/chrome/browser/push_messaging/push_messaging_service_factory.cc |
@@ -12,20 +12,28 @@ |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/push_messaging/background_budget_service_factory.h" |
#include "chrome/browser/push_messaging/push_messaging_service_impl.h" |
-#include "chrome/browser/services/gcm/fake_gcm_profile_service.h" |
#include "chrome/browser/services/gcm/gcm_profile_service_factory.h" |
+#include "chrome/browser/services/gcm/instance_id/instance_id_profile_service.h" |
+#include "chrome/browser/services/gcm/instance_id/instance_id_profile_service_factory.h" |
#include "components/keyed_service/content/browser_context_dependency_manager.h" |
// static |
PushMessagingServiceImpl* PushMessagingServiceFactory::GetForProfile( |
- content::BrowserContext* profile) { |
+ content::BrowserContext* context) { |
// The Push API is not currently supported in incognito mode. |
// See https://crbug.com/401439. |
- if (profile->IsOffTheRecord()) |
- return NULL; |
+ if (context->IsOffTheRecord()) |
+ return nullptr; |
+ |
+ if (!instance_id::InstanceIDProfileService::IsInstanceIDEnabled( |
+ Profile::FromBrowserContext(context))) { |
+ LOG(WARNING) << "PushMessagingService could not be built because " |
+ "InstanceID is unexpectedly disabled"; |
Peter Beverloo
2016/06/02 15:53:17
s/unexpectedly//, these things don't happen by acc
Peter Beverloo
2016/06/02 15:53:17
Is there a watchlist or something we can subscribe
johnme
2016/06/07 14:16:43
Done.
johnme
2016/06/07 14:16:43
Yes: https://goto.google.com/actkg
|
+ return nullptr; |
+ } |
return static_cast<PushMessagingServiceImpl*>( |
- GetInstance()->GetServiceForBrowserContext(profile, true)); |
+ GetInstance()->GetServiceForBrowserContext(context, true)); |
} |
// static |
@@ -39,6 +47,7 @@ PushMessagingServiceFactory::PushMessagingServiceFactory() |
BrowserContextDependencyManager::GetInstance()) { |
DependsOn(BackgroundBudgetServiceFactory::GetInstance()); |
DependsOn(gcm::GCMProfileServiceFactory::GetInstance()); |
+ DependsOn(instance_id::InstanceIDProfileServiceFactory::GetInstance()); |
DependsOn(HostContentSettingsMapFactory::GetInstance()); |
DependsOn(PermissionManagerFactory::GetInstance()); |
} |