Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3034)

Unified Diff: chrome/browser/push_messaging/push_messaging_service_factory.cc

Issue 1851423003: Make Web Push use InstanceID tokens instead of GCM registrations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@iid4default
Patch Set: Address review comments, and rewrite following rebase (e.g. no longer depends on NestedMessagePumpA… Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 c400f7980591700a02308bd91493e465f0c8cd79..a759cb2ed4ad4da1feea1624ba80b7f803f0deed 100644
--- a/chrome/browser/push_messaging/push_messaging_service_factory.cc
+++ b/chrome/browser/push_messaging/push_messaging_service_factory.cc
@@ -10,20 +10,28 @@
#include "chrome/browser/profiles/incognito_helpers.h"
#include "chrome/browser/profiles/profile.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))) {
+ DLOG(WARNING) << "PushMessagingService could not be built, because "
Peter Beverloo 2016/04/21 13:26:18 LOG(WARNING). When, for whatever reason, the kill
johnme 2016/05/25 14:11:50 Done.
+ "InstanceIDProfileService is unexpectedly disabled";
Peter Beverloo 2016/04/21 13:26:18 micro nits: (1) no comma (2) InstanceIDProfileSe
johnme 2016/05/25 14:11:50 Done.
+ return nullptr;
+ }
return static_cast<PushMessagingServiceImpl*>(
- GetInstance()->GetServiceForBrowserContext(profile, true));
+ GetInstance()->GetServiceForBrowserContext(context, true));
}
// static
@@ -36,6 +44,7 @@ PushMessagingServiceFactory::PushMessagingServiceFactory()
"PushMessagingProfileService",
BrowserContextDependencyManager::GetInstance()) {
DependsOn(gcm::GCMProfileServiceFactory::GetInstance());
+ DependsOn(instance_id::InstanceIDProfileServiceFactory::GetInstance());
DependsOn(HostContentSettingsMapFactory::GetInstance());
DependsOn(PermissionManagerFactory::GetInstance());
}

Powered by Google App Engine
This is Rietveld 408576698