| 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 class TextButton; | 17 class TextButton; |
| 18 } | 18 } |
| 19 | 19 |
| 20 // An infobar that shows a message, up to two optional buttons, and an optional, | 20 // 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: | 21 // right-aligned link. This is commonly used to do things like: |
| 22 // "Would you like to do X? [Yes] [No] _Learn More_ [x]" | 22 // "Would you like to do X? [Yes] [No] _Learn More_ [x]" |
| 23 class ConfirmInfoBar : public InfoBarView, | 23 class ConfirmInfoBar : public InfoBarView, |
| 24 public views::LinkListener { | 24 public views::LinkListener { |
| 25 public: | 25 public: |
| 26 ConfirmInfoBar(InfoBarTabHelper* owner, ConfirmInfoBarDelegate* delegate); | 26 ConfirmInfoBar(InfoBarTabHelper* owner, ConfirmInfoBarDelegate* delegate); |
| 27 | 27 |
| 28 private: | 28 protected: |
| 29 virtual ~ConfirmInfoBar(); | 29 virtual ~ConfirmInfoBar(); |
| 30 | 30 |
| 31 views::TextButton* ok_button() { return ok_button_; } |
| 32 |
| 31 // InfoBarView: | 33 // InfoBarView: |
| 32 virtual void Layout() OVERRIDE; | 34 virtual void Layout() OVERRIDE; |
| 33 virtual void ViewHierarchyChanged(bool is_add, | 35 virtual void ViewHierarchyChanged(bool is_add, |
| 34 View* parent, | 36 View* parent, |
| 35 View* child) OVERRIDE; | 37 View* child) OVERRIDE; |
| 36 virtual void ButtonPressed(views::Button* sender, | 38 virtual void ButtonPressed(views::Button* sender, |
| 37 const ui::Event& event) OVERRIDE; | 39 const ui::Event& event) OVERRIDE; |
| 38 virtual int ContentMinimumWidth() const OVERRIDE; | 40 virtual int ContentMinimumWidth() const OVERRIDE; |
| 39 | 41 |
| 40 // views::LinkListener: | 42 // views::LinkListener: |
| 41 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; | 43 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; |
| 42 | 44 |
| 45 private: |
| 43 ConfirmInfoBarDelegate* GetDelegate(); | 46 ConfirmInfoBarDelegate* GetDelegate(); |
| 44 | 47 |
| 45 views::Label* label_; | 48 views::Label* label_; |
| 46 views::TextButton* ok_button_; | 49 views::TextButton* ok_button_; |
| 47 views::TextButton* cancel_button_; | 50 views::TextButton* cancel_button_; |
| 48 views::Link* link_; | 51 views::Link* link_; |
| 49 | 52 |
| 50 DISALLOW_COPY_AND_ASSIGN(ConfirmInfoBar); | 53 DISALLOW_COPY_AND_ASSIGN(ConfirmInfoBar); |
| 51 }; | 54 }; |
| 52 | 55 |
| 53 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_CONFIRM_INFOBAR_H_ | 56 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_CONFIRM_INFOBAR_H_ |
| OLD | NEW |