OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_UI_VIEWS_INFOBARS_CONFIRM_INFOBAR_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_INFOBARS_CONFIRM_INFOBAR_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_INFOBARS_CONFIRM_INFOBAR_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_INFOBARS_CONFIRM_INFOBAR_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/weak_ptr.h" |
10 #include "chrome/browser/ui/views/infobars/infobar_view.h" | 11 #include "chrome/browser/ui/views/infobars/infobar_view.h" |
11 #include "ui/views/controls/link_listener.h" | 12 #include "ui/views/controls/link_listener.h" |
12 | 13 |
13 class ConfirmInfoBarDelegate; | 14 class ConfirmInfoBarDelegate; |
14 class ElevationIconSetter; | 15 class ElevationIconSetter; |
15 | 16 |
16 namespace views { | 17 namespace views { |
17 class Label; | 18 class Label; |
18 } | 19 } |
19 | 20 |
20 // An infobar that shows a message, up to two optional buttons, and an optional, | 21 // An infobar that shows a message, up to two optional buttons, and an optional, |
21 // right-aligned link. This is commonly used to do things like: | 22 // right-aligned link. This is commonly used to do things like: |
22 // "Would you like to do X? [Yes] [No] _Learn More_ [x]" | 23 // "Would you like to do X? [Yes] [No] _Learn More_ [x]" |
23 class ConfirmInfoBar : public InfoBarView, | 24 class ConfirmInfoBar |
24 public views::LinkListener { | 25 : public InfoBarView, |
| 26 public base::SupportsWeakPtr<ConfirmInfoBar>, |
| 27 public views::LinkListener { |
25 public: | 28 public: |
26 explicit ConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate> delegate); | 29 explicit ConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate> delegate); |
27 ~ConfirmInfoBar() override; | 30 ~ConfirmInfoBar() override; |
28 | 31 |
29 private: | 32 private: |
30 // InfoBarView: | 33 // InfoBarView: |
31 void Layout() override; | 34 void Layout() override; |
32 void ViewHierarchyChanged( | 35 void ViewHierarchyChanged( |
33 const ViewHierarchyChangedDetails& details) override; | 36 const ViewHierarchyChangedDetails& details) override; |
34 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 37 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
(...skipping 11 matching lines...) Expand all Loading... |
46 views::Label* label_; | 49 views::Label* label_; |
47 views::LabelButton* ok_button_; | 50 views::LabelButton* ok_button_; |
48 views::LabelButton* cancel_button_; | 51 views::LabelButton* cancel_button_; |
49 views::Link* link_; | 52 views::Link* link_; |
50 scoped_ptr<ElevationIconSetter> elevation_icon_setter_; | 53 scoped_ptr<ElevationIconSetter> elevation_icon_setter_; |
51 | 54 |
52 DISALLOW_COPY_AND_ASSIGN(ConfirmInfoBar); | 55 DISALLOW_COPY_AND_ASSIGN(ConfirmInfoBar); |
53 }; | 56 }; |
54 | 57 |
55 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_CONFIRM_INFOBAR_H_ | 58 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_CONFIRM_INFOBAR_H_ |
OLD | NEW |