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

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

Issue 1158923002: Remove support for the "gcm_user_visible_only" manifest key. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a message Created 5 years, 7 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_impl.cc
diff --git a/chrome/browser/push_messaging/push_messaging_service_impl.cc b/chrome/browser/push_messaging/push_messaging_service_impl.cc
index 92a3cad9b54a92f3b02b68b48ae48fa31336dcf0..1fe0ba50d1990ca800b6de100193acc5d7ba1570 100644
--- a/chrome/browser/push_messaging/push_messaging_service_impl.cc
+++ b/chrome/browser/push_messaging/push_messaging_service_impl.cc
@@ -41,6 +41,14 @@
namespace {
const int kMaxRegistrations = 1000000;
+// Chrome does not yet support silent push messages, and requires websites to
+// indicate that they will only send user-visible messages.
+const char kSilentPushUnsupportedMessage[] =
+ "Chrome currently only supports the Push API for subscriptions that will "
+ "result in user-visible messages. You can indicate this by calling "
+ "pushManager.subscribe({userVisibleOnly: true}) instead. See "
+ "https://goo.gl/yqv4Q4 for more details.";
+
void RecordDeliveryStatus(content::PushDeliveryStatus status) {
UMA_HISTOGRAM_ENUMERATION("PushMessaging.DeliveryStatus",
status,
@@ -331,8 +339,13 @@ void PushMessagingServiceImpl::SubscribeFromDocument(
PushMessagingPermissionContext* permission_context =
PushMessagingPermissionContextFactory::GetForProfile(profile_);
+ DCHECK(permission_context);
+
+ if (!user_visible) {
+ web_contents->GetMainFrame()->AddMessageToConsole(
+ content::CONSOLE_MESSAGE_LEVEL_ERROR,
+ kSilentPushUnsupportedMessage);
- if (permission_context == NULL || !user_visible) {
SubscribeEnd(callback,
std::string(),
content::PUSH_REGISTRATION_STATUS_PERMISSION_DENIED);

Powered by Google App Engine
This is Rietveld 408576698