Index: content/renderer/push_messaging/push_messaging_dispatcher.cc |
diff --git a/content/renderer/push_messaging/push_messaging_dispatcher.cc b/content/renderer/push_messaging/push_messaging_dispatcher.cc |
index e3f838a1af4d3d55f6a211b989542cd4b5a2f677..87d542898db980ed76fd413d0d1476d8d504b64a 100644 |
--- a/content/renderer/push_messaging/push_messaging_dispatcher.cc |
+++ b/content/renderer/push_messaging/push_messaging_dispatcher.cc |
@@ -15,12 +15,19 @@ |
#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/WebPushSubscriptionOptions.h" |
+#include "third_party/WebKit/public/web/WebConsoleMessage.h" |
+#include "third_party/WebKit/public/web/WebLocalFrame.h" |
#include "url/gurl.h" |
using blink::WebString; |
namespace content { |
+const char kManifestDeprecationWarning[] = |
johnme
2015/05/20 14:05:41
Move to anonymous namespace?
Peter Beverloo
2015/05/20 14:15:13
No, constants are internally linked by default so
|
+ "The 'gcm_user_visible_only' manifest key is deprecated and will be " |
+ "removed in Chrome 45, around August 2015. Use PushSubscriptionOptions " |
johnme
2015/05/20 14:05:41
Nit: How about "Call pushManager.subscribe({userVi
Peter Beverloo
2015/05/20 14:15:14
Changed..
|
+ "when subscribing for push instead."; |
+ |
PushMessagingDispatcher::PushMessagingDispatcher(RenderFrame* render_frame) |
: RenderFrameObserver(render_frame) { |
} |
@@ -74,8 +81,17 @@ void PushMessagingDispatcher::DoSubscribe( |
return; |
} |
- // TODO(peter): Display a deprecation warning if gcm_user_visible_only is |
- // set to true. See https://crbug.com/471534 |
+ // Support for the "gcm_user_visible_only" Manifest key has been deprecated |
+ // 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); |
johnme
2015/05/20 14:05:41
Ideally we'd log no more than once per page load;
Peter Beverloo
2015/05/20 14:15:13
Acknowledged.
|
+ } |
+ |
const bool user_visible = manifest.gcm_user_visible_only || |
options.userVisibleOnly; |