simple_alert_infobar_delegate.cc 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright (c) 2012 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. #include "components/infobars/core/simple_alert_infobar_delegate.h"
  5. #include <memory>
  6. #include "third_party/skia/include/core/SkBitmap.h"
  7. SimpleAlertInfoBarDelegate::SimpleAlertInfoBarDelegate(
  8. infobars::InfoBarDelegate::InfoBarIdentifier infobar_identifier,
  9. const gfx::VectorIcon* vector_icon,
  10. const std::u16string& message,
  11. bool auto_expire,
  12. bool should_animate)
  13. : infobar_identifier_(infobar_identifier),
  14. vector_icon_(vector_icon),
  15. message_(message),
  16. auto_expire_(auto_expire),
  17. should_animate_(should_animate) {}
  18. SimpleAlertInfoBarDelegate::~SimpleAlertInfoBarDelegate() = default;
  19. infobars::InfoBarDelegate::InfoBarIdentifier
  20. SimpleAlertInfoBarDelegate::GetIdentifier() const {
  21. return infobar_identifier_;
  22. }
  23. const gfx::VectorIcon& SimpleAlertInfoBarDelegate::GetVectorIcon() const {
  24. return vector_icon_ ? *vector_icon_ : InfoBarDelegate::GetVectorIcon();
  25. }
  26. bool SimpleAlertInfoBarDelegate::ShouldExpire(
  27. const NavigationDetails& details) const {
  28. return auto_expire_ && ConfirmInfoBarDelegate::ShouldExpire(details);
  29. }
  30. bool SimpleAlertInfoBarDelegate::ShouldAnimate() const {
  31. return should_animate_ && ConfirmInfoBarDelegate::ShouldAnimate();
  32. }
  33. std::u16string SimpleAlertInfoBarDelegate::GetMessageText() const {
  34. return message_;
  35. }
  36. int SimpleAlertInfoBarDelegate::GetButtons() const {
  37. return BUTTON_NONE;
  38. }