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/debug/trace_event.h" |
7 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/infobars/infobar_tab_helper.h" | 9 #include "chrome/browser/infobars/infobar_tab_helper.h" |
9 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/ui/gtk/browser_window_gtk.h" | 11 #include "chrome/browser/ui/gtk/browser_window_gtk.h" |
11 #include "chrome/browser/ui/gtk/custom_button.h" | 12 #include "chrome/browser/ui/gtk/custom_button.h" |
12 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" | 13 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" |
13 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 14 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
14 #include "chrome/browser/ui/gtk/gtk_util.h" | 15 #include "chrome/browser/ui/gtk/gtk_util.h" |
15 #include "chrome/browser/ui/gtk/infobars/infobar_container_gtk.h" | 16 #include "chrome/browser/ui/gtk/infobars/infobar_container_gtk.h" |
16 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 17 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 void InfoBarGtk::OnCloseButton(GtkWidget* button) { | 206 void InfoBarGtk::OnCloseButton(GtkWidget* button) { |
206 // If we're not owned, we're already closing, so don't call | 207 // If we're not owned, we're already closing, so don't call |
207 // InfoBarDismissed(), since this can lead to us double-recording dismissals. | 208 // InfoBarDismissed(), since this can lead to us double-recording dismissals. |
208 if (delegate() && owned()) | 209 if (delegate() && owned()) |
209 delegate()->InfoBarDismissed(); | 210 delegate()->InfoBarDismissed(); |
210 RemoveSelf(); | 211 RemoveSelf(); |
211 } | 212 } |
212 | 213 |
213 gboolean InfoBarGtk::OnBackgroundExpose(GtkWidget* sender, | 214 gboolean InfoBarGtk::OnBackgroundExpose(GtkWidget* sender, |
214 GdkEventExpose* event) { | 215 GdkEventExpose* event) { |
| 216 TRACE_EVENT0("ui::gtk", "InfoBarGtk::OnBackgroundExpose"); |
| 217 |
215 const int height = sender->allocation.height; | 218 const int height = sender->allocation.height; |
216 | 219 |
217 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(sender->window)); | 220 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(sender->window)); |
218 gdk_cairo_rectangle(cr, &event->area); | 221 gdk_cairo_rectangle(cr, &event->area); |
219 cairo_clip(cr); | 222 cairo_clip(cr); |
220 | 223 |
221 cairo_pattern_t* pattern = cairo_pattern_create_linear(0, 0, 0, height); | 224 cairo_pattern_t* pattern = cairo_pattern_create_linear(0, 0, 0, height); |
222 | 225 |
223 double top_r, top_g, top_b; | 226 double top_r, top_g, top_b; |
224 GetTopColor(delegate()->GetInfoBarType(), &top_r, &top_g, &top_b); | 227 GetTopColor(delegate()->GetInfoBarType(), &top_r, &top_g, &top_b); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 const content::NotificationSource& source, | 286 const content::NotificationSource& source, |
284 const content::NotificationDetails& details) { | 287 const content::NotificationDetails& details) { |
285 UpdateBorderColor(); | 288 UpdateBorderColor(); |
286 } | 289 } |
287 | 290 |
288 void InfoBarGtk::OnChildSizeRequest(GtkWidget* expanded, | 291 void InfoBarGtk::OnChildSizeRequest(GtkWidget* expanded, |
289 GtkWidget* child, | 292 GtkWidget* child, |
290 GtkRequisition* requisition) { | 293 GtkRequisition* requisition) { |
291 requisition->height = -1; | 294 requisition->height = -1; |
292 } | 295 } |
OLD | NEW |