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

Unified Diff: chrome/browser/extensions/api/notifications/notifications_api.cc

Issue 1135213004: Returning error when NotificationConversionHelper::NotificationBitmapToGfxImage() get failed in not… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/notifications/notifications_api.cc
diff --git a/chrome/browser/extensions/api/notifications/notifications_api.cc b/chrome/browser/extensions/api/notifications/notifications_api.cc
index 71fb9122a375d0082b8a09c53efa7e975eab4f38..28406a0abc96b622440ddf0105a233bd7356f7c3 100644
--- a/chrome/browser/extensions/api/notifications/notifications_api.cc
+++ b/chrome/browser/extensions/api/notifications/notifications_api.cc
@@ -318,17 +318,23 @@ bool NotificationsApiFunction::UpdateNotification(
// TODO(dewittj): Return error if this fails.
Peter Beverloo 2015/05/13 10:52:42 This TODO is now redundant.
Deepak 2015/05/13 13:21:11 Done.
if (options->icon_bitmap) {
gfx::Image icon;
- NotificationConversionHelper::NotificationBitmapToGfxImage(
- image_scale, bitmap_sizes.icon_size, options->icon_bitmap.get(), &icon);
+ if (!NotificationConversionHelper::NotificationBitmapToGfxImage(
+ image_scale, bitmap_sizes.icon_size, options->icon_bitmap.get(),
+ &icon)) {
+ SetError(kUnableToDecodeIconError);
+ return false;
+ }
notification->set_icon(icon);
}
- gfx::Image app_icon_mask;
- if (NotificationConversionHelper::NotificationBitmapToGfxImage(
- image_scale,
- bitmap_sizes.app_icon_mask_size,
- options->app_icon_mask_bitmap.get(),
- &app_icon_mask)) {
+ if (options->app_icon_mask_url.get()) {
+ gfx::Image app_icon_mask;
+ if (!NotificationConversionHelper::NotificationBitmapToGfxImage(
Peter Beverloo 2015/05/13 10:54:04 On a slightly higher-level note, now that most cal
Deepak 2015/05/13 13:21:11 Done.
+ image_scale, bitmap_sizes.app_icon_mask_size,
+ options->app_icon_mask_bitmap.get(), &app_icon_mask)) {
+ SetError(kUnableToDecodeIconError);
+ return false;
+ }
notification->set_small_image(app_icon_mask);
}
@@ -363,12 +369,16 @@ bool NotificationsApiFunction::UpdateNotification(
}
gfx::Image image;
Peter Beverloo 2015/05/13 10:52:42 You can now move this to within the body of the ne
Deepak 2015/05/13 13:21:11 Done.
- bool has_image = NotificationConversionHelper::NotificationBitmapToGfxImage(
- image_scale,
- bitmap_sizes.image_size,
- options->image_bitmap.get(),
- &image);
- if (has_image) {
+ if (options->image_url.get()) {
+ bool has_image = NotificationConversionHelper::NotificationBitmapToGfxImage(
+ image_scale,
+ bitmap_sizes.image_size,
+ options->image_bitmap.get(),
+ &image);
+ if (!has_image) {
+ SetError(kUnableToDecodeIconError);
+ return false;
+ }
// We should have an image if and only if the type is an image type.
if (notification->type() != message_center::NOTIFICATION_TYPE_IMAGE) {
SetError(kExtraImageProvided);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698