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 "chrome/browser/ui/views/infobars/infobar_view.h" | 10 #include "chrome/browser/ui/views/infobars/infobar_view.h" |
11 #include "ui/views/controls/link_listener.h" | 11 #include "ui/views/controls/link_listener.h" |
12 | 12 |
13 class ConfirmInfoBarDelegate; | 13 class ConfirmInfoBarDelegate; |
14 | 14 |
15 namespace views { | 15 namespace views { |
16 class Label; | 16 class Label; |
17 } | 17 } |
18 | 18 |
19 // An infobar that shows a message, up to two optional buttons, and an optional, | 19 // An infobar that shows a message, up to two optional buttons, and an optional, |
20 // right-aligned link. This is commonly used to do things like: | 20 // right-aligned link. This is commonly used to do things like: |
21 // "Would you like to do X? [Yes] [No] _Learn More_ [x]" | 21 // "Would you like to do X? [Yes] [No] _Learn More_ [x]" |
22 class ConfirmInfoBar : public InfoBarView, | 22 class ConfirmInfoBar : public InfoBarView, |
23 public views::LinkListener { | 23 public views::LinkListener { |
24 public: | 24 public: |
25 ConfirmInfoBar(InfoBarService* owner, ConfirmInfoBarDelegate* delegate); | 25 explicit ConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate> delegate); |
26 | 26 |
27 private: | 27 private: |
28 virtual ~ConfirmInfoBar(); | 28 virtual ~ConfirmInfoBar(); |
29 | 29 |
30 // InfoBarView: | 30 // InfoBarView: |
31 virtual void Layout() OVERRIDE; | 31 virtual void Layout() OVERRIDE; |
32 virtual void ViewHierarchyChanged( | 32 virtual void ViewHierarchyChanged( |
33 const ViewHierarchyChangedDetails& details) OVERRIDE; | 33 const ViewHierarchyChangedDetails& details) OVERRIDE; |
34 virtual void ButtonPressed(views::Button* sender, | 34 virtual void ButtonPressed(views::Button* sender, |
35 const ui::Event& event) OVERRIDE; | 35 const ui::Event& event) OVERRIDE; |
36 virtual int ContentMinimumWidth() const OVERRIDE; | 36 virtual int ContentMinimumWidth() const OVERRIDE; |
37 | 37 |
38 // views::LinkListener: | 38 // views::LinkListener: |
39 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; | 39 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; |
40 | 40 |
41 ConfirmInfoBarDelegate* GetDelegate(); | 41 ConfirmInfoBarDelegate* GetDelegate(); |
42 | 42 |
43 views::Label* label_; | 43 views::Label* label_; |
44 views::LabelButton* ok_button_; | 44 views::LabelButton* ok_button_; |
45 views::LabelButton* cancel_button_; | 45 views::LabelButton* cancel_button_; |
46 views::Link* link_; | 46 views::Link* link_; |
47 | 47 |
48 DISALLOW_COPY_AND_ASSIGN(ConfirmInfoBar); | 48 DISALLOW_COPY_AND_ASSIGN(ConfirmInfoBar); |
49 }; | 49 }; |
50 | 50 |
51 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_CONFIRM_INFOBAR_H_ | 51 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_CONFIRM_INFOBAR_H_ |
OLD | NEW |