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

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

Issue 2711623003: Update infobars to use VectorIcon struct instead of VectorIconId. (Closed)
Patch Set: rebase Created 3 years, 9 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 <memory> 7 #include <memory>
8 8
9 #include "components/infobars/core/infobar.h" 9 #include "components/infobars/core/infobar.h"
10 #include "components/infobars/core/infobar_manager.h" 10 #include "components/infobars/core/infobar_manager.h"
11 #include "third_party/skia/include/core/SkBitmap.h" 11 #include "third_party/skia/include/core/SkBitmap.h"
12 12
13 // static 13 // static
14 void SimpleAlertInfoBarDelegate::Create( 14 void SimpleAlertInfoBarDelegate::Create(
15 infobars::InfoBarManager* infobar_manager, 15 infobars::InfoBarManager* infobar_manager,
16 infobars::InfoBarDelegate::InfoBarIdentifier infobar_identifier, 16 infobars::InfoBarDelegate::InfoBarIdentifier infobar_identifier,
17 int icon_id, 17 const gfx::VectorIcon* vector_icon,
18 gfx::VectorIconId vector_icon_id,
19 const base::string16& message, 18 const base::string16& message,
20 bool auto_expire) { 19 bool auto_expire) {
21 infobar_manager->AddInfoBar(infobar_manager->CreateConfirmInfoBar( 20 infobar_manager->AddInfoBar(infobar_manager->CreateConfirmInfoBar(
22 std::unique_ptr<ConfirmInfoBarDelegate>(new SimpleAlertInfoBarDelegate( 21 std::unique_ptr<ConfirmInfoBarDelegate>(new SimpleAlertInfoBarDelegate(
23 infobar_identifier, icon_id, vector_icon_id, message, auto_expire)))); 22 infobar_identifier, vector_icon, message, auto_expire))));
24 } 23 }
25 24
26 SimpleAlertInfoBarDelegate::SimpleAlertInfoBarDelegate( 25 SimpleAlertInfoBarDelegate::SimpleAlertInfoBarDelegate(
27 infobars::InfoBarDelegate::InfoBarIdentifier infobar_identifier, 26 infobars::InfoBarDelegate::InfoBarIdentifier infobar_identifier,
28 int icon_id, 27 const gfx::VectorIcon* vector_icon,
29 gfx::VectorIconId vector_icon_id,
30 const base::string16& message, 28 const base::string16& message,
31 bool auto_expire) 29 bool auto_expire)
32 : ConfirmInfoBarDelegate(), 30 : ConfirmInfoBarDelegate(),
33 infobar_identifier_(infobar_identifier), 31 infobar_identifier_(infobar_identifier),
34 icon_id_(icon_id), 32 vector_icon_(vector_icon),
35 vector_icon_id_(vector_icon_id),
36 message_(message), 33 message_(message),
37 auto_expire_(auto_expire) {} 34 auto_expire_(auto_expire) {}
38 35
39 SimpleAlertInfoBarDelegate::~SimpleAlertInfoBarDelegate() { 36 SimpleAlertInfoBarDelegate::~SimpleAlertInfoBarDelegate() {
40 } 37 }
41 38
42 infobars::InfoBarDelegate::InfoBarIdentifier 39 infobars::InfoBarDelegate::InfoBarIdentifier
43 SimpleAlertInfoBarDelegate::GetIdentifier() const { 40 SimpleAlertInfoBarDelegate::GetIdentifier() const {
44 return infobar_identifier_; 41 return infobar_identifier_;
45 } 42 }
46 43
47 int SimpleAlertInfoBarDelegate::GetIconId() const { 44 const gfx::VectorIcon& SimpleAlertInfoBarDelegate::GetVectorIcon() const {
48 return icon_id_; 45 return vector_icon_ ? *vector_icon_ : InfoBarDelegate::GetVectorIcon();
49 }
50
51 gfx::VectorIconId SimpleAlertInfoBarDelegate::GetVectorIconId() const {
52 return vector_icon_id_;
53 } 46 }
54 47
55 bool SimpleAlertInfoBarDelegate::ShouldExpire( 48 bool SimpleAlertInfoBarDelegate::ShouldExpire(
56 const NavigationDetails& details) const { 49 const NavigationDetails& details) const {
57 return auto_expire_ && ConfirmInfoBarDelegate::ShouldExpire(details); 50 return auto_expire_ && ConfirmInfoBarDelegate::ShouldExpire(details);
58 } 51 }
59 52
60 base::string16 SimpleAlertInfoBarDelegate::GetMessageText() const { 53 base::string16 SimpleAlertInfoBarDelegate::GetMessageText() const {
61 return message_; 54 return message_;
62 } 55 }
63 56
64 int SimpleAlertInfoBarDelegate::GetButtons() const { 57 int SimpleAlertInfoBarDelegate::GetButtons() const {
65 return BUTTON_NONE; 58 return BUTTON_NONE;
66 } 59 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698