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 #include "chrome/browser/ui/gtk/infobars/infobar_gtk.h" | 5 #include "chrome/browser/ui/gtk/infobars/infobar_gtk.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/ui/gtk/browser_window_gtk.h" | 8 #include "chrome/browser/ui/gtk/browser_window_gtk.h" |
9 #include "chrome/browser/ui/gtk/custom_button.h" | 9 #include "chrome/browser/ui/gtk/custom_button.h" |
10 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" | 10 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 *r = SkColorGetR(color) / 255.0; | 177 *r = SkColorGetR(color) / 255.0; |
178 *g = SkColorGetG(color) / 255.0; | 178 *g = SkColorGetG(color) / 255.0; |
179 *b = SkColorGetB(color) / 255.0; | 179 *b = SkColorGetB(color) / 255.0; |
180 } | 180 } |
181 | 181 |
182 void InfoBarGtk::UpdateBorderColor() { | 182 void InfoBarGtk::UpdateBorderColor() { |
183 gtk_widget_queue_draw(widget()); | 183 gtk_widget_queue_draw(widget()); |
184 } | 184 } |
185 | 185 |
186 void InfoBarGtk::OnCloseButton(GtkWidget* button) { | 186 void InfoBarGtk::OnCloseButton(GtkWidget* button) { |
187 // If we're not owned, we're already closing, so don't call | 187 if (!owned()) |
188 // InfoBarDismissed(), since this can lead to us double-recording dismissals. | 188 return; // We're closing; don't call anything, it might access the owner. |
189 if (delegate() && owned()) | 189 delegate()->InfoBarDismissed(); |
190 delegate()->InfoBarDismissed(); | |
191 RemoveSelf(); | 190 RemoveSelf(); |
192 } | 191 } |
193 | 192 |
194 gboolean InfoBarGtk::OnBackgroundExpose(GtkWidget* sender, | 193 gboolean InfoBarGtk::OnBackgroundExpose(GtkWidget* sender, |
195 GdkEventExpose* event) { | 194 GdkEventExpose* event) { |
196 const int height = sender->allocation.height; | 195 const int height = sender->allocation.height; |
197 | 196 |
198 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(sender->window)); | 197 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(sender->window)); |
199 gdk_cairo_rectangle(cr, &event->area); | 198 gdk_cairo_rectangle(cr, &event->area); |
200 cairo_clip(cr); | 199 cairo_clip(cr); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 const NotificationSource& source, | 255 const NotificationSource& source, |
257 const NotificationDetails& details) { | 256 const NotificationDetails& details) { |
258 UpdateBorderColor(); | 257 UpdateBorderColor(); |
259 } | 258 } |
260 | 259 |
261 void InfoBarGtk::OnChildSizeRequest(GtkWidget* expanded, | 260 void InfoBarGtk::OnChildSizeRequest(GtkWidget* expanded, |
262 GtkWidget* child, | 261 GtkWidget* child, |
263 GtkRequisition* requisition) { | 262 GtkRequisition* requisition) { |
264 requisition->height = -1; | 263 requisition->height = -1; |
265 } | 264 } |
OLD | NEW |