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 "chrome/browser/infobars/simple_alert_infobar_delegate.h" | 5 #include "chrome/browser/infobars/simple_alert_infobar_delegate.h" |
6 | 6 |
7 #include "chrome/browser/infobars/infobar.h" | |
8 #include "chrome/browser/infobars/infobar_service.h" | 7 #include "chrome/browser/infobars/infobar_service.h" |
9 #include "third_party/skia/include/core/SkBitmap.h" | 8 #include "third_party/skia/include/core/SkBitmap.h" |
10 | 9 |
11 // static | 10 // static |
12 void SimpleAlertInfoBarDelegate::Create(InfoBarService* infobar_service, | 11 void SimpleAlertInfoBarDelegate::Create(InfoBarService* infobar_service, |
13 int icon_id, | 12 int icon_id, |
14 const string16& message, | 13 const string16& message, |
15 bool auto_expire) { | 14 bool auto_expire) { |
16 infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( | 15 infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>( |
17 scoped_ptr<ConfirmInfoBarDelegate>( | 16 new SimpleAlertInfoBarDelegate(infobar_service, icon_id, message, |
18 new SimpleAlertInfoBarDelegate(icon_id, message, auto_expire)))); | 17 auto_expire))); |
19 } | 18 } |
20 | 19 |
21 SimpleAlertInfoBarDelegate::SimpleAlertInfoBarDelegate( | 20 SimpleAlertInfoBarDelegate::SimpleAlertInfoBarDelegate( |
| 21 InfoBarService* infobar_service, |
22 int icon_id, | 22 int icon_id, |
23 const string16& message, | 23 const string16& message, |
24 bool auto_expire) | 24 bool auto_expire) |
25 : ConfirmInfoBarDelegate(), | 25 : ConfirmInfoBarDelegate(infobar_service), |
26 icon_id_(icon_id), | 26 icon_id_(icon_id), |
27 message_(message), | 27 message_(message), |
28 auto_expire_(auto_expire) { | 28 auto_expire_(auto_expire) { |
29 } | 29 } |
30 | 30 |
31 SimpleAlertInfoBarDelegate::~SimpleAlertInfoBarDelegate() { | 31 SimpleAlertInfoBarDelegate::~SimpleAlertInfoBarDelegate() { |
32 } | 32 } |
33 | 33 |
34 int SimpleAlertInfoBarDelegate::GetIconID() const { | 34 int SimpleAlertInfoBarDelegate::GetIconID() const { |
35 return icon_id_; | 35 return icon_id_; |
36 } | 36 } |
37 | 37 |
38 string16 SimpleAlertInfoBarDelegate::GetMessageText() const { | 38 string16 SimpleAlertInfoBarDelegate::GetMessageText() const { |
39 return message_; | 39 return message_; |
40 } | 40 } |
41 | 41 |
42 int SimpleAlertInfoBarDelegate::GetButtons() const { | 42 int SimpleAlertInfoBarDelegate::GetButtons() const { |
43 return BUTTON_NONE; | 43 return BUTTON_NONE; |
44 } | 44 } |
45 | 45 |
46 bool SimpleAlertInfoBarDelegate::ShouldExpireInternal( | 46 bool SimpleAlertInfoBarDelegate::ShouldExpireInternal( |
47 const content::LoadCommittedDetails& details) const { | 47 const content::LoadCommittedDetails& details) const { |
48 return auto_expire_ && ConfirmInfoBarDelegate::ShouldExpireInternal(details); | 48 return auto_expire_ && ConfirmInfoBarDelegate::ShouldExpireInternal(details); |
49 } | 49 } |
OLD | NEW |