notification_utils.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // Copyright 2018 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. #ifndef ASH_PUBLIC_CPP_NOTIFICATION_UTILS_H_
  5. #define ASH_PUBLIC_CPP_NOTIFICATION_UTILS_H_
  6. #include <memory>
  7. #include <string>
  8. #include "ash/public/cpp/ash_public_export.h"
  9. #include "base/memory/scoped_refptr.h"
  10. #include "ui/gfx/color_palette.h"
  11. #include "ui/message_center/public/cpp/notification.h"
  12. #include "ui/message_center/public/cpp/notification_types.h"
  13. #include "ui/message_center/public/cpp/notifier_id.h"
  14. class GURL;
  15. namespace gfx {
  16. struct VectorIcon;
  17. }
  18. namespace ui {
  19. namespace message_center {
  20. class NotificationDelegate;
  21. } // namespace message_center
  22. } // namespace ui
  23. namespace ash {
  24. // Accent colors of system notifications.
  25. constexpr SkColor kSystemNotificationColorNormal = gfx::kGoogleBlue700;
  26. constexpr SkColor kSystemNotificationColorWarning = gfx::kGoogleYellow900;
  27. constexpr SkColor kSystemNotificationColorCriticalWarning = gfx::kGoogleRed700;
  28. // Factory method to create all kinds of notifications generated by system,
  29. // from normal priority ones to critical priority ones.
  30. // |small_image| is a small icon show on the upper left header to illustrate
  31. // |display_source| of the notification.
  32. // One specified in the |optional_fields| is overridden.
  33. ASH_PUBLIC_EXPORT std::unique_ptr<message_center::Notification>
  34. CreateSystemNotification(
  35. message_center::NotificationType type,
  36. const std::string& id,
  37. const std::u16string& title,
  38. const std::u16string& message,
  39. const std::u16string& display_source,
  40. const GURL& origin_url,
  41. const message_center::NotifierId& notifier_id,
  42. const message_center::RichNotificationData& optional_fields,
  43. scoped_refptr<message_center::NotificationDelegate> delegate,
  44. const gfx::VectorIcon& small_image,
  45. message_center::SystemNotificationWarningLevel warning_level);
  46. } // namespace ash
  47. #endif // ASH_PUBLIC_CPP_NOTIFICATION_UTILS_H_