| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_INFOBARS_CORE_SIMPLE_ALERT_INFOBAR_DELEGATE_H_ | 5 #ifndef COMPONENTS_INFOBARS_CORE_SIMPLE_ALERT_INFOBAR_DELEGATE_H_ |
| 6 #define COMPONENTS_INFOBARS_CORE_SIMPLE_ALERT_INFOBAR_DELEGATE_H_ | 6 #define COMPONENTS_INFOBARS_CORE_SIMPLE_ALERT_INFOBAR_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 11 #include "components/infobars/core/confirm_infobar_delegate.h" | 11 #include "components/infobars/core/confirm_infobar_delegate.h" |
| 12 #include "ui/gfx/vector_icons_public.h" | 12 |
| 13 namespace gfx { |
| 14 struct VectorIcon; |
| 15 } |
| 13 | 16 |
| 14 namespace infobars { | 17 namespace infobars { |
| 15 class InfoBarManager; | 18 class InfoBarManager; |
| 16 } | 19 } |
| 17 | 20 |
| 18 class SimpleAlertInfoBarDelegate : public ConfirmInfoBarDelegate { | 21 class SimpleAlertInfoBarDelegate : public ConfirmInfoBarDelegate { |
| 19 public: | 22 public: |
| 20 // Creates a simple alert infobar and delegate and adds the infobar to | 23 // Creates a simple alert infobar and delegate and adds the infobar to |
| 21 // |infobar_manager|. If |vector_icon_id| is not VECTOR_ICON_NONE, it will be | 24 // |infobar_manager|. If |vector_icon| is not null, it will be shown. |
| 22 // shown; otherwise, |icon_id| (if present) will be used as the icon. | |
| 23 // |infobar_identifier| names what class triggered the infobar for metrics. | 25 // |infobar_identifier| names what class triggered the infobar for metrics. |
| 24 static void Create( | 26 static void Create( |
| 25 infobars::InfoBarManager* infobar_manager, | 27 infobars::InfoBarManager* infobar_manager, |
| 26 infobars::InfoBarDelegate::InfoBarIdentifier infobar_identifier, | 28 infobars::InfoBarDelegate::InfoBarIdentifier infobar_identifier, |
| 27 int icon_id, | 29 const gfx::VectorIcon* vector_icon, |
| 28 gfx::VectorIconId vector_icon_id, | |
| 29 const base::string16& message, | 30 const base::string16& message, |
| 30 bool auto_expire); | 31 bool auto_expire); |
| 31 | 32 |
| 32 private: | 33 private: |
| 33 SimpleAlertInfoBarDelegate( | 34 SimpleAlertInfoBarDelegate( |
| 34 infobars::InfoBarDelegate::InfoBarIdentifier infobar_identifier, | 35 infobars::InfoBarDelegate::InfoBarIdentifier infobar_identifier, |
| 35 int icon_id, | 36 const gfx::VectorIcon* vector_icon, |
| 36 gfx::VectorIconId vector_icon_id, | |
| 37 const base::string16& message, | 37 const base::string16& message, |
| 38 bool auto_expire); | 38 bool auto_expire); |
| 39 ~SimpleAlertInfoBarDelegate() override; | 39 ~SimpleAlertInfoBarDelegate() override; |
| 40 | 40 |
| 41 // ConfirmInfoBarDelegate: | 41 // ConfirmInfoBarDelegate: |
| 42 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; | 42 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; |
| 43 int GetIconId() const override; | 43 const gfx::VectorIcon& GetVectorIcon() const override; |
| 44 gfx::VectorIconId GetVectorIconId() const override; | |
| 45 bool ShouldExpire(const NavigationDetails& details) const override; | 44 bool ShouldExpire(const NavigationDetails& details) const override; |
| 46 base::string16 GetMessageText() const override; | 45 base::string16 GetMessageText() const override; |
| 47 int GetButtons() const override; | 46 int GetButtons() const override; |
| 48 | 47 |
| 49 infobars::InfoBarDelegate::InfoBarIdentifier infobar_identifier_; | 48 infobars::InfoBarDelegate::InfoBarIdentifier infobar_identifier_; |
| 50 const int icon_id_; | 49 const gfx::VectorIcon* vector_icon_; |
| 51 gfx::VectorIconId vector_icon_id_; | |
| 52 base::string16 message_; | 50 base::string16 message_; |
| 53 bool auto_expire_; // Should it expire automatically on navigation? | 51 bool auto_expire_; // Should it expire automatically on navigation? |
| 54 | 52 |
| 55 DISALLOW_COPY_AND_ASSIGN(SimpleAlertInfoBarDelegate); | 53 DISALLOW_COPY_AND_ASSIGN(SimpleAlertInfoBarDelegate); |
| 56 }; | 54 }; |
| 57 | 55 |
| 58 #endif // COMPONENTS_INFOBARS_CORE_SIMPLE_ALERT_INFOBAR_DELEGATE_H_ | 56 #endif // COMPONENTS_INFOBARS_CORE_SIMPLE_ALERT_INFOBAR_DELEGATE_H_ |
| OLD | NEW |