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 int icon_id, | 14 int icon_id, |
| 15 gfx::VectorIconId vector_icon_id, |
15 const base::string16& message, | 16 const base::string16& message, |
16 bool auto_expire) { | 17 bool auto_expire) { |
17 infobar_manager->AddInfoBar( | 18 infobar_manager->AddInfoBar(infobar_manager->CreateConfirmInfoBar( |
18 infobar_manager->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( | 19 scoped_ptr<ConfirmInfoBarDelegate>(new SimpleAlertInfoBarDelegate( |
19 new SimpleAlertInfoBarDelegate(icon_id, message, auto_expire)))); | 20 icon_id, vector_icon_id, message, auto_expire)))); |
20 } | 21 } |
21 | 22 |
22 SimpleAlertInfoBarDelegate::SimpleAlertInfoBarDelegate( | 23 SimpleAlertInfoBarDelegate::SimpleAlertInfoBarDelegate( |
23 int icon_id, | 24 int icon_id, |
| 25 gfx::VectorIconId vector_icon_id, |
24 const base::string16& message, | 26 const base::string16& message, |
25 bool auto_expire) | 27 bool auto_expire) |
26 : ConfirmInfoBarDelegate(), | 28 : ConfirmInfoBarDelegate(), |
27 icon_id_(icon_id), | 29 icon_id_(icon_id), |
| 30 vector_icon_id_(vector_icon_id), |
28 message_(message), | 31 message_(message), |
29 auto_expire_(auto_expire) { | 32 auto_expire_(auto_expire) {} |
30 } | |
31 | 33 |
32 SimpleAlertInfoBarDelegate::~SimpleAlertInfoBarDelegate() { | 34 SimpleAlertInfoBarDelegate::~SimpleAlertInfoBarDelegate() { |
33 } | 35 } |
34 | 36 |
35 int SimpleAlertInfoBarDelegate::GetIconId() const { | 37 int SimpleAlertInfoBarDelegate::GetIconId() const { |
36 return icon_id_; | 38 return icon_id_; |
37 } | 39 } |
38 | 40 |
| 41 gfx::VectorIconId SimpleAlertInfoBarDelegate::GetVectorIconId() const { |
| 42 return vector_icon_id_; |
| 43 } |
| 44 |
39 bool SimpleAlertInfoBarDelegate::ShouldExpire( | 45 bool SimpleAlertInfoBarDelegate::ShouldExpire( |
40 const NavigationDetails& details) const { | 46 const NavigationDetails& details) const { |
41 return auto_expire_ && ConfirmInfoBarDelegate::ShouldExpire(details); | 47 return auto_expire_ && ConfirmInfoBarDelegate::ShouldExpire(details); |
42 } | 48 } |
43 | 49 |
44 base::string16 SimpleAlertInfoBarDelegate::GetMessageText() const { | 50 base::string16 SimpleAlertInfoBarDelegate::GetMessageText() const { |
45 return message_; | 51 return message_; |
46 } | 52 } |
47 | 53 |
48 int SimpleAlertInfoBarDelegate::GetButtons() const { | 54 int SimpleAlertInfoBarDelegate::GetButtons() const { |
49 return BUTTON_NONE; | 55 return BUTTON_NONE; |
50 } | 56 } |
OLD | NEW |