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

Unified Diff: content/browser/notifications/notification_message_filter.cc

Issue 2261283002: Add Notification images (Blink + desktop implementation) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Check IPC drawsNothing rather than isNull Created 4 years, 4 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: content/browser/notifications/notification_message_filter.cc
diff --git a/content/browser/notifications/notification_message_filter.cc b/content/browser/notifications/notification_message_filter.cc
index e37d21b6fe1b61a6bc02acdb37b422dd95ca1181..c2a9e2b26bb2d142cc28f1dd73cfca4f8645d385 100644
--- a/content/browser/notifications/notification_message_filter.cc
+++ b/content/browser/notifications/notification_message_filter.cc
@@ -7,6 +7,7 @@
#include <utility>
#include "base/callback.h"
+#include "base/command_line.h"
#include "content/browser/bad_message.h"
#include "content/browser/notifications/page_notification_delegate.h"
#include "content/browser/notifications/platform_notification_context_impl.h"
@@ -20,6 +21,7 @@
#include "content/public/browser/platform_notification_service.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/common/content_client.h"
+#include "content/public/common/content_switches.h"
#include "third_party/WebKit/public/platform/modules/notifications/WebNotificationConstants.h"
namespace content {
@@ -48,6 +50,16 @@ PlatformNotificationData SanitizeNotificationData(
// Returns true when |resources| looks ok, false otherwise.
bool ValidateNotificationResources(const NotificationResources& resources) {
+ // TODO(johnme): Remove this once https://crbug.com/614456 ships to stable.
+ if (!resources.image.drawsNothing() &&
+ !base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableExperimentalWebPlatformFeatures)) {
+ return false;
+ }
+ if (resources.image.width() > blink::kWebNotificationMaxImageWidthPx ||
+ resources.image.height() > blink::kWebNotificationMaxImageHeightPx) {
+ return false;
+ }
if (resources.notification_icon.width() >
blink::kWebNotificationMaxIconSizePx ||
resources.notification_icon.height() >

Powered by Google App Engine
This is Rietveld 408576698