| 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 #include "components/infobars/core/simple_alert_infobar_delegate.h" | 5 #include "components/infobars/core/simple_alert_infobar_delegate.h" |
| 6 | 6 |
| 7 #include "components/infobars/core/infobar.h" | 7 #include "components/infobars/core/infobar.h" |
| 8 #include "components/infobars/core/infobar_manager.h" | 8 #include "components/infobars/core/infobar_manager.h" |
| 9 #include "third_party/skia/include/core/SkBitmap.h" | 9 #include "third_party/skia/include/core/SkBitmap.h" |
| 10 | 10 |
| 11 // static | 11 // static |
| 12 void SimpleAlertInfoBarDelegate::Create( | 12 void SimpleAlertInfoBarDelegate::Create( |
| 13 infobars::InfoBarManager* infobar_manager, | 13 infobars::InfoBarManager* infobar_manager, |
| 14 const std::string& infobar_identifier, |
| 14 int icon_id, | 15 int icon_id, |
| 15 gfx::VectorIconId vector_icon_id, | 16 gfx::VectorIconId vector_icon_id, |
| 16 const base::string16& message, | 17 const base::string16& message, |
| 17 bool auto_expire) { | 18 bool auto_expire) { |
| 18 infobar_manager->AddInfoBar(infobar_manager->CreateConfirmInfoBar( | 19 infobar_manager->AddInfoBar(infobar_manager->CreateConfirmInfoBar( |
| 19 scoped_ptr<ConfirmInfoBarDelegate>(new SimpleAlertInfoBarDelegate( | 20 scoped_ptr<ConfirmInfoBarDelegate>(new SimpleAlertInfoBarDelegate( |
| 20 icon_id, vector_icon_id, message, auto_expire)))); | 21 infobar_identifier, icon_id, vector_icon_id, message, auto_expire)))); |
| 21 } | 22 } |
| 22 | 23 |
| 23 SimpleAlertInfoBarDelegate::SimpleAlertInfoBarDelegate( | 24 SimpleAlertInfoBarDelegate::SimpleAlertInfoBarDelegate( |
| 25 const std::string& infobar_identifier, |
| 24 int icon_id, | 26 int icon_id, |
| 25 gfx::VectorIconId vector_icon_id, | 27 gfx::VectorIconId vector_icon_id, |
| 26 const base::string16& message, | 28 const base::string16& message, |
| 27 bool auto_expire) | 29 bool auto_expire) |
| 28 : ConfirmInfoBarDelegate(), | 30 : ConfirmInfoBarDelegate(), |
| 31 infobar_identifier_(infobar_identifier), |
| 29 icon_id_(icon_id), | 32 icon_id_(icon_id), |
| 30 vector_icon_id_(vector_icon_id), | 33 vector_icon_id_(vector_icon_id), |
| 31 message_(message), | 34 message_(message), |
| 32 auto_expire_(auto_expire) {} | 35 auto_expire_(auto_expire) {} |
| 33 | 36 |
| 34 SimpleAlertInfoBarDelegate::~SimpleAlertInfoBarDelegate() { | 37 SimpleAlertInfoBarDelegate::~SimpleAlertInfoBarDelegate() { |
| 35 } | 38 } |
| 36 | 39 |
| 40 std::string SimpleAlertInfoBarDelegate::GetIdentifier() const { |
| 41 return infobar_identifier_; |
| 42 } |
| 43 |
| 37 int SimpleAlertInfoBarDelegate::GetIconId() const { | 44 int SimpleAlertInfoBarDelegate::GetIconId() const { |
| 38 return icon_id_; | 45 return icon_id_; |
| 39 } | 46 } |
| 40 | 47 |
| 41 gfx::VectorIconId SimpleAlertInfoBarDelegate::GetVectorIconId() const { | 48 gfx::VectorIconId SimpleAlertInfoBarDelegate::GetVectorIconId() const { |
| 42 return vector_icon_id_; | 49 return vector_icon_id_; |
| 43 } | 50 } |
| 44 | 51 |
| 45 bool SimpleAlertInfoBarDelegate::ShouldExpire( | 52 bool SimpleAlertInfoBarDelegate::ShouldExpire( |
| 46 const NavigationDetails& details) const { | 53 const NavigationDetails& details) const { |
| 47 return auto_expire_ && ConfirmInfoBarDelegate::ShouldExpire(details); | 54 return auto_expire_ && ConfirmInfoBarDelegate::ShouldExpire(details); |
| 48 } | 55 } |
| 49 | 56 |
| 50 base::string16 SimpleAlertInfoBarDelegate::GetMessageText() const { | 57 base::string16 SimpleAlertInfoBarDelegate::GetMessageText() const { |
| 51 return message_; | 58 return message_; |
| 52 } | 59 } |
| 53 | 60 |
| 54 int SimpleAlertInfoBarDelegate::GetButtons() const { | 61 int SimpleAlertInfoBarDelegate::GetButtons() const { |
| 55 return BUTTON_NONE; | 62 return BUTTON_NONE; |
| 56 } | 63 } |
| OLD | NEW |