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_INFOBAR_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_VIEW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/task.h" | 9 #include "base/task.h" |
10 #include "ui/base/animation/animation_delegate.h" | 10 #include "ui/base/animation/animation_delegate.h" |
11 #include "views/controls/button/button.h" | 11 #include "views/controls/button/button.h" |
12 #include "views/focus/focus_manager.h" | 12 #include "views/focus/focus_manager.h" |
13 | 13 |
14 class InfoBarContainer; | 14 class InfoBarContainer; |
15 class InfoBarDelegate; | 15 class InfoBarDelegate; |
16 | 16 |
17 namespace ui { | 17 namespace ui { |
18 class SlideAnimation; | 18 class SlideAnimation; |
19 } | 19 } |
20 | 20 |
21 namespace views { | 21 namespace views { |
22 class ExternalFocusTracker; | 22 class ExternalFocusTracker; |
23 class ImageButton; | 23 class ImageButton; |
24 class ImageView; | 24 class ImageView; |
25 class Label; | 25 class Label; |
| 26 class Link; |
| 27 class LinkController; |
| 28 class MenuButton; |
| 29 class TextButton; |
| 30 class ViewMenuDelegate; |
26 } | 31 } |
27 | 32 |
28 // TODO(pkasting): infobar_delegate.h forward declares "class InfoBar" but the | 33 // TODO(pkasting): infobar_delegate.h forward declares "class InfoBar" but the |
29 // definitions are (right now) completely port-specific. This stub class will | 34 // definitions are (right now) completely port-specific. This stub class will |
30 // be turned into the cross-platform base class for InfoBar views (in the MVC | 35 // be turned into the cross-platform base class for InfoBar views (in the MVC |
31 // sense). Right now it's just here so the various InfoBarDelegates can | 36 // sense). Right now it's just here so the various InfoBarDelegates can |
32 // continue to return an InfoBar*, it doesn't do anything. | 37 // continue to return an InfoBar*, it doesn't do anything. |
33 class InfoBar { | 38 class InfoBar { |
34 public: | 39 public: |
35 explicit InfoBar(InfoBarDelegate* delegate) {} | 40 explicit InfoBar(InfoBarDelegate* delegate) {} |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // The target height of the InfoBar, regardless of what its current height | 82 // The target height of the InfoBar, regardless of what its current height |
78 // is (due to animation). | 83 // is (due to animation). |
79 static const int kDefaultTargetHeight; | 84 static const int kDefaultTargetHeight; |
80 static const int kHorizontalPadding; | 85 static const int kHorizontalPadding; |
81 static const int kIconLabelSpacing; | 86 static const int kIconLabelSpacing; |
82 static const int kButtonButtonSpacing; | 87 static const int kButtonButtonSpacing; |
83 static const int kEndOfLabelSpacing; | 88 static const int kEndOfLabelSpacing; |
84 | 89 |
85 virtual ~InfoBarView(); | 90 virtual ~InfoBarView(); |
86 | 91 |
| 92 // Creates a label with the appropriate font and color for an infobar. |
| 93 static views::Label* CreateLabel(const string16& text); |
| 94 |
| 95 // Creates a link with the appropriate font and color for an infobar. |
| 96 static views::Link* CreateLink(const string16& text, |
| 97 views::LinkController* controller, |
| 98 const SkColor& background_color); |
| 99 |
| 100 // Creates a menu button with an infobar-specific appearance. |
| 101 static views::MenuButton* CreateMenuButton( |
| 102 const string16& text, |
| 103 bool normal_has_border, |
| 104 views::ViewMenuDelegate* menu_delegate); |
| 105 |
| 106 // Creates a text button with an infobar-specific appearance. |
| 107 static views::TextButton* CreateTextButton(views::ButtonListener* listener, |
| 108 const string16& text, |
| 109 bool needs_elevation); |
| 110 |
87 // views::View: | 111 // views::View: |
88 virtual void Layout(); | 112 virtual void Layout(); |
89 virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child); | 113 virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child); |
90 | 114 |
91 // views::ButtonListener: | 115 // views::ButtonListener: |
92 virtual void ButtonPressed(views::Button* sender, const views::Event& event); | 116 virtual void ButtonPressed(views::Button* sender, const views::Event& event); |
93 | 117 |
94 // ui::AnimationDelegate: | 118 // ui::AnimationDelegate: |
95 virtual void AnimationProgressed(const ui::Animation* animation); | 119 virtual void AnimationProgressed(const ui::Animation* animation); |
96 | 120 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 // Used to delete this object after a return to the message loop. | 179 // Used to delete this object after a return to the message loop. |
156 ScopedRunnableMethodFactory<InfoBarView> delete_factory_; | 180 ScopedRunnableMethodFactory<InfoBarView> delete_factory_; |
157 | 181 |
158 // The target height for the InfoBarView. | 182 // The target height for the InfoBarView. |
159 int target_height_; | 183 int target_height_; |
160 | 184 |
161 DISALLOW_COPY_AND_ASSIGN(InfoBarView); | 185 DISALLOW_COPY_AND_ASSIGN(InfoBarView); |
162 }; | 186 }; |
163 | 187 |
164 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_VIEW_H_ | 188 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_VIEW_H_ |
OLD | NEW |