| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_GTK_INFOBAR_GTK_H_ | 5 #ifndef CHROME_BROWSER_GTK_INFOBAR_GTK_H_ |
| 6 #define CHROME_BROWSER_GTK_INFOBAR_GTK_H_ | 6 #define CHROME_BROWSER_GTK_INFOBAR_GTK_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "chrome/browser/gtk/slide_animator_gtk.h" | 10 #include "chrome/browser/gtk/slide_animator_gtk.h" |
| 11 #include "chrome/common/owned_widget_gtk.h" | 11 #include "chrome/common/owned_widget_gtk.h" |
| 12 | 12 |
| 13 class CustomDrawButton; | 13 class CustomDrawButton; |
| 14 class InfoBarContainerGtk; | 14 class InfoBarContainerGtk; |
| 15 class InfoBarDelegate; | 15 class InfoBarDelegate; |
| 16 | 16 |
| 17 // Struct that represents a color gradient. |
| 18 struct InfoBarStyle { |
| 19 InfoBarStyle(); |
| 20 InfoBarStyle(const double top[3], |
| 21 const double bottom[3], |
| 22 int height, |
| 23 GdkColor text_color, |
| 24 bool even); |
| 25 double gradient_top_[3]; |
| 26 double gradient_bottom_[3]; |
| 27 int height_; |
| 28 GdkColor text_color_; |
| 29 bool even_; |
| 30 }; |
| 31 |
| 17 class InfoBar : public SlideAnimatorGtk::Delegate { | 32 class InfoBar : public SlideAnimatorGtk::Delegate { |
| 18 public: | 33 public: |
| 19 explicit InfoBar(InfoBarDelegate* delegate); | 34 explicit InfoBar(InfoBarDelegate* delegate); |
| 20 virtual ~InfoBar(); | 35 virtual ~InfoBar(); |
| 21 | 36 |
| 22 InfoBarDelegate* delegate() const { return delegate_; } | 37 InfoBarDelegate* delegate() const { return delegate_; } |
| 23 | 38 |
| 24 // Get the top level native GTK widget for this infobar. | 39 // Get the top level native GTK widget for this infobar. |
| 25 GtkWidget* widget(); | 40 GtkWidget* widget(); |
| 26 | 41 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 53 // Removes our associated InfoBarDelegate from the associated TabContents. | 68 // Removes our associated InfoBarDelegate from the associated TabContents. |
| 54 // (Will lead to this InfoBar being closed). | 69 // (Will lead to this InfoBar being closed). |
| 55 void RemoveInfoBar() const; | 70 void RemoveInfoBar() const; |
| 56 | 71 |
| 57 // The top level widget of the infobar. | 72 // The top level widget of the infobar. |
| 58 scoped_ptr<SlideAnimatorGtk> slide_widget_; | 73 scoped_ptr<SlideAnimatorGtk> slide_widget_; |
| 59 | 74 |
| 60 // The second highest level widget of the infobar. | 75 // The second highest level widget of the infobar. |
| 61 OwnedWidgetGtk border_bin_; | 76 OwnedWidgetGtk border_bin_; |
| 62 | 77 |
| 78 // The vbox that holds text and some other elements, if they want. |
| 79 GtkWidget* vbox_; |
| 80 |
| 63 // The hbox that holds infobar elements (button, text, icon, etc.). | 81 // The hbox that holds infobar elements (button, text, icon, etc.). |
| 64 GtkWidget* hbox_; | 82 GtkWidget* hbox_; |
| 65 | 83 |
| 66 // The x that closes the bar. | 84 // The x that closes the bar. |
| 67 scoped_ptr<CustomDrawButton> close_button_; | 85 scoped_ptr<CustomDrawButton> close_button_; |
| 68 | 86 |
| 69 // The InfoBar's container | 87 // The InfoBar's container |
| 70 InfoBarContainerGtk* container_; | 88 InfoBarContainerGtk* container_; |
| 71 | 89 |
| 72 // The InfoBar's delegate. | 90 // The InfoBar's delegate. |
| 73 InfoBarDelegate* delegate_; | 91 InfoBarDelegate* delegate_; |
| 74 | 92 |
| 93 // The colors to use when generating the background gradient of the infobar. |
| 94 InfoBarStyle style_; |
| 75 private: | 95 private: |
| 76 static void OnCloseButton(GtkWidget* button, InfoBar* info_bar); | 96 static void OnCloseButton(GtkWidget* button, InfoBar* info_bar); |
| 77 | 97 |
| 78 DISALLOW_COPY_AND_ASSIGN(InfoBar); | 98 DISALLOW_COPY_AND_ASSIGN(InfoBar); |
| 79 }; | 99 }; |
| 80 | 100 |
| 81 #endif // CHROME_BROWSER_GTK_INFOBAR_GTK_H_ | 101 #endif // CHROME_BROWSER_GTK_INFOBAR_GTK_H_ |
| OLD | NEW |