Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 class NotificationConversionHelper { | |
|
dewittj
2014/08/13 18:30:18
please add a class comment
liyanhou
2014/08/13 20:28:57
Done.
| |
| 25 public: | |
| 26 // Converts Notification::Notification data to | |
| 27 // extensions::api::notifications::NotificationOptions. | |
| 28 static void NotificationToNotificationOptions( | |
| 29 const Notification& notification, | |
| 30 extensions::api::notifications::NotificationOptions* options); | |
| 31 | |
| 32 // Converts gfx::Image (in ARGB format) type to | |
| 33 // extensions::api::notifications::NotificationBitmap type (RGBA). | |
| 34 static void GfxImageToNotificationBitmap( | |
| 35 const gfx::Image* gfx_image, | |
| 36 extensions::api::notifications::NotificationBitmap* return_image_args); | |
| 37 | |
| 38 // Converts an extensions::api::notifications::NotificationBitmap type object | |
| 39 // with width, height, and data in RGBA format into an gfx::Image (ARGB). | |
| 40 static bool NotificationBitmapToGfxImage( | |
| 41 float max_scale, | |
| 42 const gfx::Size& target_size_dips, | |
| 43 extensions::api::notifications::NotificationBitmap* notification_bitmap, | |
| 44 gfx::Image* return_image); | |
| 45 | |
| 46 private: | |
| 47 // Conversts message_center::NotificationType to string type used to convert | |
| 48 // to extensions::api::notifications::TemplateType | |
| 49 static std::string MapTypeToString(message_center::NotificationType type); | |
| 50 }; | |
| 51 | |
| 52 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_CONVERSION_HELPER_H_ | |
| OLD | NEW |