OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_VIEWS_INFOBARS_INFOBARS_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_INFOBARS_INFOBARS_H_ |
6 #define CHROME_BROWSER_VIEWS_INFOBARS_INFOBARS_H_ | 6 #define CHROME_BROWSER_VIEWS_INFOBARS_INFOBARS_H_ |
7 | 7 |
8 #include "app/animation.h" | 8 #include "app/animation.h" |
9 #include "base/task.h" | 9 #include "base/task.h" |
10 #include "chrome/browser/tab_contents/infobar_delegate.h" | 10 #include "chrome/browser/tab_contents/infobar_delegate.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 public: | 44 public: |
45 explicit InfoBar(InfoBarDelegate* delegate); | 45 explicit InfoBar(InfoBarDelegate* delegate); |
46 virtual ~InfoBar(); | 46 virtual ~InfoBar(); |
47 | 47 |
48 InfoBarDelegate* delegate() const { return delegate_; } | 48 InfoBarDelegate* delegate() const { return delegate_; } |
49 | 49 |
50 // Set a link to the parent InfoBarContainer. This must be set before the | 50 // Set a link to the parent InfoBarContainer. This must be set before the |
51 // InfoBar is added to the view hierarchy. | 51 // InfoBar is added to the view hierarchy. |
52 void set_container(InfoBarContainer* container) { container_ = container; } | 52 void set_container(InfoBarContainer* container) { container_ = container; } |
53 | 53 |
54 // Starts animating the InfoBar open. | |
55 void AnimateOpen(); | |
56 | |
57 // Opens the InfoBar immediately. | |
58 void Open(); | |
59 | |
60 // Starts animating the InfoBar closed. It will not be closed until the | |
61 // animation has completed, when |Close| will be called. | |
62 void AnimateClose(); | |
63 | |
64 // Closes the InfoBar immediately and removes it from its container. Notifies | |
65 // the delegate that it has closed. The InfoBar is deleted after this function | |
66 // is called. | |
67 void Close(); | |
68 | |
69 // The target height of the InfoBar, regardless of what its current height | 54 // The target height of the InfoBar, regardless of what its current height |
70 // is (due to animation). | 55 // is (due to animation). |
71 static const double kDefaultTargetHeight; | 56 static const double kDefaultTargetHeight; |
72 | 57 |
73 static const int kHorizontalPadding; | 58 static const int kHorizontalPadding; |
74 static const int kIconLabelSpacing; | 59 static const int kIconLabelSpacing; |
75 static const int kButtonButtonSpacing; | 60 static const int kButtonButtonSpacing; |
76 static const int kEndOfLabelSpacing; | 61 static const int kEndOfLabelSpacing; |
77 static const int kCloseButtonSpacing; | 62 static const int kCloseButtonSpacing; |
78 static const int kButtonInLabelSpacing; | 63 static const int kButtonInLabelSpacing; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 int OffsetY(views::View* parent, const gfx::Size prefsize); | 96 int OffsetY(views::View* parent, const gfx::Size prefsize); |
112 | 97 |
113 // Overridden from views::ButtonListener: | 98 // Overridden from views::ButtonListener: |
114 virtual void ButtonPressed(views::Button* sender, const views::Event& event); | 99 virtual void ButtonPressed(views::Button* sender, const views::Event& event); |
115 | 100 |
116 // Overridden from AnimationDelegate: | 101 // Overridden from AnimationDelegate: |
117 virtual void AnimationProgressed(const Animation* animation); | 102 virtual void AnimationProgressed(const Animation* animation); |
118 virtual void AnimationEnded(const Animation* animation); | 103 virtual void AnimationEnded(const Animation* animation); |
119 | 104 |
120 private: | 105 private: |
| 106 friend class InfoBarContainer; |
| 107 |
| 108 // Starts animating the InfoBar open. |
| 109 void AnimateOpen(); |
| 110 |
| 111 // Opens the InfoBar immediately. |
| 112 void Open(); |
| 113 |
| 114 // Starts animating the InfoBar closed. It will not be closed until the |
| 115 // animation has completed, when |Close| will be called. |
| 116 void AnimateClose(); |
| 117 |
| 118 // Closes the InfoBar immediately and removes it from its container. Notifies |
| 119 // the delegate that it has closed. The InfoBar is deleted after this function |
| 120 // is called. |
| 121 void Close(); |
| 122 |
121 // Called when an InfoBar is added or removed from a view hierarchy to do | 123 // Called when an InfoBar is added or removed from a view hierarchy to do |
122 // setup and shutdown. | 124 // setup and shutdown. |
123 void InfoBarAdded(); | 125 void InfoBarAdded(); |
124 void InfoBarRemoved(); | 126 void InfoBarRemoved(); |
125 | 127 |
126 // Destroys the external focus tracker, if present. If |restore_focus| is | 128 // Destroys the external focus tracker, if present. If |restore_focus| is |
127 // true, restores focus to the view tracked by the focus tracker before doing | 129 // true, restores focus to the view tracked by the focus tracker before doing |
128 // so. | 130 // so. |
129 void DestroyFocusTracker(bool restore_focus); | 131 void DestroyFocusTracker(bool restore_focus); |
130 | 132 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 views::NativeButton* cancel_button_; | 236 views::NativeButton* cancel_button_; |
235 views::Link* link_; | 237 views::Link* link_; |
236 | 238 |
237 bool initialized_; | 239 bool initialized_; |
238 | 240 |
239 DISALLOW_COPY_AND_ASSIGN(ConfirmInfoBar); | 241 DISALLOW_COPY_AND_ASSIGN(ConfirmInfoBar); |
240 }; | 242 }; |
241 | 243 |
242 | 244 |
243 #endif // CHROME_BROWSER_VIEWS_INFOBARS_INFOBARS_H_ | 245 #endif // CHROME_BROWSER_VIEWS_INFOBARS_INFOBARS_H_ |
OLD | NEW |