OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_GTK_INFOBARS_INFOBAR_GTK_H_ | 5 #ifndef CHROME_BROWSER_UI_GTK_INFOBARS_INFOBAR_GTK_H_ |
6 #define CHROME_BROWSER_UI_GTK_INFOBARS_INFOBAR_GTK_H_ | 6 #define CHROME_BROWSER_UI_GTK_INFOBARS_INFOBAR_GTK_H_ |
7 | 7 |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 class GtkSignalRegistrar; | 25 class GtkSignalRegistrar; |
26 class MenuModel; | 26 class MenuModel; |
27 } | 27 } |
28 | 28 |
29 class InfoBarGtk : public InfoBar, | 29 class InfoBarGtk : public InfoBar, |
30 public content::NotificationObserver { | 30 public content::NotificationObserver { |
31 public: | 31 public: |
32 InfoBarGtk(InfoBarService* owner, InfoBarDelegate* delegate); | 32 InfoBarGtk(InfoBarService* owner, InfoBarDelegate* delegate); |
33 virtual ~InfoBarGtk(); | 33 virtual ~InfoBarGtk(); |
34 | 34 |
| 35 // Must be called before we try to show the infobar. Inits any widgets and |
| 36 // related objects necessary. This must be called only once during the |
| 37 // infobar's life. |
| 38 // |
| 39 // NOTE: Subclasses who need to init widgets should override this function and |
| 40 // explicitly call their parent's implementation first, then continue with |
| 41 // further work they need to do. Failing to call the parent implementation |
| 42 // first (or at all), or setting up widgets in the constructor instead of |
| 43 // here, will lead to bad side effects like crashing or having this function |
| 44 // get called repeatedly. |
| 45 virtual void InitWidgets(); |
| 46 |
35 // Get the top level native GTK widget for this infobar. | 47 // Get the top level native GTK widget for this infobar. |
36 GtkWidget* widget(); | 48 GtkWidget* widget(); |
37 | 49 |
38 GdkColor GetBorderColor() const; | 50 GdkColor GetBorderColor() const; |
39 | 51 |
40 // Returns the target height of the infobar if the bar is animating, | 52 // Returns the target height of the infobar if the bar is animating, |
41 // otherwise 0. We care about this number since we want to prevent | 53 // otherwise 0. We care about this number since we want to prevent |
42 // unnecessary renderer repaints while animating. | 54 // unnecessary renderer repaints while animating. |
43 int AnimatingHeight() const; | 55 int AnimatingHeight() const; |
44 | 56 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 scoped_ptr<ui::GtkSignalRegistrar> signals_; | 142 scoped_ptr<ui::GtkSignalRegistrar> signals_; |
131 | 143 |
132 // The current menu displayed. Can be null. We own this on the base class so | 144 // The current menu displayed. Can be null. We own this on the base class so |
133 // we can cancel the menu while we're closing. | 145 // we can cancel the menu while we're closing. |
134 scoped_ptr<MenuGtk> menu_; | 146 scoped_ptr<MenuGtk> menu_; |
135 | 147 |
136 DISALLOW_COPY_AND_ASSIGN(InfoBarGtk); | 148 DISALLOW_COPY_AND_ASSIGN(InfoBarGtk); |
137 }; | 149 }; |
138 | 150 |
139 #endif // CHROME_BROWSER_UI_GTK_INFOBARS_INFOBAR_GTK_H_ | 151 #endif // CHROME_BROWSER_UI_GTK_INFOBARS_INFOBAR_GTK_H_ |
OLD | NEW |