Index: trunk/src/chrome/browser/ui/gtk/infobars/infobar_gtk.cc |
=================================================================== |
--- trunk/src/chrome/browser/ui/gtk/infobars/infobar_gtk.cc (revision 238401) |
+++ trunk/src/chrome/browser/ui/gtk/infobars/infobar_gtk.cc (working copy) |
@@ -52,8 +52,8 @@ |
// static |
const int InfoBarGtk::kEndOfLabelSpacing = 6; |
-InfoBarGtk::InfoBarGtk(scoped_ptr<InfoBarDelegate> delegate) |
- : InfoBar(delegate.Pass()), |
+InfoBarGtk::InfoBarGtk(InfoBarService* owner, InfoBarDelegate* delegate) |
+ : InfoBar(owner, delegate), |
bg_box_(NULL), |
hbox_(NULL), |
theme_service_(NULL), |
@@ -63,32 +63,7 @@ |
InfoBarGtk::~InfoBarGtk() { |
} |
-GdkColor InfoBarGtk::GetBorderColor() const { |
- DCHECK(theme_service_); |
- return theme_service_->GetBorderColor(); |
-} |
- |
-int InfoBarGtk::AnimatingHeight() const { |
- return animation().is_animating() ? bar_target_height() : 0; |
-} |
- |
-SkColor InfoBarGtk::ConvertGetColor(ColorGetter getter) { |
- double r, g, b; |
- (this->*getter)(delegate()->GetInfoBarType(), &r, &g, &b); |
- return SkColorSetARGB(255, 255 * r, 255 * g, 255 * b); |
-} |
- |
-void InfoBarGtk::GetTopColor(InfoBarDelegate::Type type, |
- double* r, double* g, double* b) { |
- GetBackgroundColor(InfoBar::GetTopColor(type), r, g, b); |
-} |
- |
-void InfoBarGtk::GetBottomColor(InfoBarDelegate::Type type, |
- double* r, double* g, double* b) { |
- GetBackgroundColor(InfoBar::GetBottomColor(type), r, g, b); |
-} |
- |
-void InfoBarGtk::PlatformSpecificSetOwner() { |
+void InfoBarGtk::InitWidgets() { |
DCHECK(owner()); |
DCHECK(!theme_service_); |
theme_service_ = GtkThemeService::GetFrom(Profile::FromBrowserContext( |
@@ -139,6 +114,31 @@ |
UpdateBorderColor(); |
} |
+GdkColor InfoBarGtk::GetBorderColor() const { |
+ DCHECK(theme_service_); |
+ return theme_service_->GetBorderColor(); |
+} |
+ |
+int InfoBarGtk::AnimatingHeight() const { |
+ return animation().is_animating() ? bar_target_height() : 0; |
+} |
+ |
+SkColor InfoBarGtk::ConvertGetColor(ColorGetter getter) { |
+ double r, g, b; |
+ (this->*getter)(delegate()->GetInfoBarType(), &r, &g, &b); |
+ return SkColorSetARGB(255, 255 * r, 255 * g, 255 * b); |
+} |
+ |
+void InfoBarGtk::GetTopColor(InfoBarDelegate::Type type, |
+ double* r, double* g, double* b) { |
+ GetBackgroundColor(InfoBar::GetTopColor(type), r, g, b); |
+} |
+ |
+void InfoBarGtk::GetBottomColor(InfoBarDelegate::Type type, |
+ double* r, double* g, double* b) { |
+ GetBackgroundColor(InfoBar::GetBottomColor(type), r, g, b); |
+} |
+ |
void InfoBarGtk::PlatformSpecificShow(bool animate) { |
DCHECK(bg_box_); |
@@ -274,7 +274,7 @@ |
void InfoBarGtk::OnCloseButton(GtkWidget* button) { |
// If we're not owned, we're already closing, so don't call |
// InfoBarDismissed(), since this can lead to us double-recording dismissals. |
- if (owner()) |
+ if (delegate() && owner()) |
delegate()->InfoBarDismissed(); |
RemoveSelf(); |
} |