Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: components/infobars/core/simple_alert_infobar_delegate.cc

Issue 1520543004: Add method for identifying different InfoBars (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Missed a spot. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 infobars::InfoBarDelegate::InfoBarIdentifier 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 infobars::InfoBarDelegate::InfoBarIdentifier 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),
Peter Kasting 2015/12/30 01:52:57 I realized while reviewing this that we could avoi
gone 2015/12/30 07:29:03 Huh, that would have definitely made sense for thi
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 infobars::InfoBarDelegate::InfoBarIdentifier
41 SimpleAlertInfoBarDelegate::GetIdentifier() const {
42 return infobar_identifier_;
43 }
44
37 int SimpleAlertInfoBarDelegate::GetIconId() const { 45 int SimpleAlertInfoBarDelegate::GetIconId() const {
38 return icon_id_; 46 return icon_id_;
39 } 47 }
40 48
41 gfx::VectorIconId SimpleAlertInfoBarDelegate::GetVectorIconId() const { 49 gfx::VectorIconId SimpleAlertInfoBarDelegate::GetVectorIconId() const {
42 return vector_icon_id_; 50 return vector_icon_id_;
43 } 51 }
44 52
45 bool SimpleAlertInfoBarDelegate::ShouldExpire( 53 bool SimpleAlertInfoBarDelegate::ShouldExpire(
46 const NavigationDetails& details) const { 54 const NavigationDetails& details) const {
47 return auto_expire_ && ConfirmInfoBarDelegate::ShouldExpire(details); 55 return auto_expire_ && ConfirmInfoBarDelegate::ShouldExpire(details);
48 } 56 }
49 57
50 base::string16 SimpleAlertInfoBarDelegate::GetMessageText() const { 58 base::string16 SimpleAlertInfoBarDelegate::GetMessageText() const {
51 return message_; 59 return message_;
52 } 60 }
53 61
54 int SimpleAlertInfoBarDelegate::GetButtons() const { 62 int SimpleAlertInfoBarDelegate::GetButtons() const {
55 return BUTTON_NONE; 63 return BUTTON_NONE;
56 } 64 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698