Commit 2d902560 authored by peter's avatar peter Committed by Commit bot

Include a deprecation warning when people only use "gcm_user_visible_only".

Usage of the "gcm_user_visible_only" Manifest key has been deprecated in favor
of using PushSubscriptionOptions when subscribing. Show a deprecation
warning when only the former is used.

BUG=471534

Review URL: https://codereview.chromium.org/1145163002

Cr-Commit-Position: refs/heads/master@{#330735}
parent 5a63fc3c
...@@ -15,12 +15,20 @@ ...@@ -15,12 +15,20 @@
#include "third_party/WebKit/public/platform/modules/push_messaging/WebPushError.h" #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushError.h"
#include "third_party/WebKit/public/platform/modules/push_messaging/WebPushSubscription.h" #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushSubscription.h"
#include "third_party/WebKit/public/platform/modules/push_messaging/WebPushSubscriptionOptions.h" #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushSubscriptionOptions.h"
#include "third_party/WebKit/public/web/WebConsoleMessage.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "url/gurl.h" #include "url/gurl.h"
using blink::WebString; using blink::WebString;
namespace content { namespace content {
const char kManifestDeprecationWarning[] =
"The 'gcm_user_visible_only' manifest key is deprecated and will be "
"removed in Chrome 45, around August 2015. Use pushManager.subscribe({"
"userVisibleOnly: true}) instead. See https://goo.gl/RHFwWx for more "
"details.";
PushMessagingDispatcher::PushMessagingDispatcher(RenderFrame* render_frame) PushMessagingDispatcher::PushMessagingDispatcher(RenderFrame* render_frame)
: RenderFrameObserver(render_frame) { : RenderFrameObserver(render_frame) {
} }
...@@ -74,8 +82,17 @@ void PushMessagingDispatcher::DoSubscribe( ...@@ -74,8 +82,17 @@ void PushMessagingDispatcher::DoSubscribe(
return; return;
} }
// TODO(peter): Display a deprecation warning if gcm_user_visible_only is // Support for the "gcm_user_visible_only" Manifest key has been deprecated
// set to true. See https://crbug.com/471534 // in favor of the userVisibleOnly subscription option, and will be removed
// in a future Chrome release. Inform developers of this deprecation.
if (manifest.gcm_user_visible_only && !options.userVisibleOnly) {
blink::WebConsoleMessage message(
blink::WebConsoleMessage::LevelWarning,
blink::WebString::fromUTF8(kManifestDeprecationWarning));
render_frame()->GetWebFrame()->addMessageToConsole(message);
}
const bool user_visible = manifest.gcm_user_visible_only || const bool user_visible = manifest.gcm_user_visible_only ||
options.userVisibleOnly; options.userVisibleOnly;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment