1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_CONVERSION_HELPER_H_
6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_CONVERSION_HELPER_H_
8 #include "chrome/browser/notifications/notification.h"
9 #include "ui/message_center/notification_types.h"
11 namespace extensions
{
13 namespace notifications
{
14 struct NotificationOptions
;
15 struct NotificationBitmap
;
16 } // namespace notifications
18 } // namespace extensions
24 // This class provides some static helper functions that could be used to
25 // convert between different types of notification data.
26 class NotificationConversionHelper
{
28 // Converts Notification::Notification data to
29 // extensions::api::notifications::NotificationOptions.
30 static void NotificationToNotificationOptions(
31 const Notification
& notification
,
32 extensions::api::notifications::NotificationOptions
* options
);
34 // Converts gfx::Image (in ARGB format) type to
35 // extensions::api::notifications::NotificationBitmap type (RGBA).
36 static void GfxImageToNotificationBitmap(
37 const gfx::Image
* gfx_image
,
38 extensions::api::notifications::NotificationBitmap
* return_image_args
);
40 // Converts an extensions::api::notifications::NotificationBitmap type object
41 // with width, height, and data in RGBA format into an gfx::Image (ARGB).
42 static bool NotificationBitmapToGfxImage(
44 const gfx::Size
& target_size_dips
,
45 extensions::api::notifications::NotificationBitmap
* notification_bitmap
,
46 gfx::Image
* return_image
);
49 // Conversts message_center::NotificationType to string type used to convert
50 // to extensions::api::notifications::TemplateType
51 static std::string
MapTypeToString(message_center::NotificationType type
);
54 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_CONVERSION_HELPER_H_