Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / notifications / notification_conversion_helper.h
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.
4
5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_CONVERSION_HELPER_H_
6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_CONVERSION_HELPER_H_
7
8 #include "chrome/browser/notifications/notification.h"
9 #include "ui/message_center/notification_types.h"
10
11 namespace extensions {
12 namespace api {
13 namespace notifications {
14 struct NotificationOptions;
15 struct NotificationBitmap;
16 }  // namespace notifications
17 }  // namespace api
18 }  // namespace extensions
19
20 namespace gfx {
21 class Image;
22 }
23
24 // This class provides some static helper functions that could be used to
25 // convert between different types of notification data.
26 class NotificationConversionHelper {
27  public:
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);
33
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);
39
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(
43       float max_scale,
44       const gfx::Size& target_size_dips,
45       extensions::api::notifications::NotificationBitmap* notification_bitmap,
46       gfx::Image* return_image);
47
48  private:
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);
52 };
53
54 #endif  // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_CONVERSION_HELPER_H_