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/tabs/tab_renderer_gtk.h" | 5 #include "chrome/browser/ui/gtk/tabs/tab_renderer_gtk.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
| 10 #include "base/debug/trace_event.h" |
10 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
11 #include "chrome/browser/defaults.h" | 12 #include "chrome/browser/defaults.h" |
12 #include "chrome/browser/extensions/extension_tab_helper.h" | 13 #include "chrome/browser/extensions/extension_tab_helper.h" |
13 #include "chrome/browser/favicon/favicon_tab_helper.h" | 14 #include "chrome/browser/favicon/favicon_tab_helper.h" |
14 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
16 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" | 17 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" |
17 #include "chrome/browser/ui/gtk/custom_button.h" | 18 #include "chrome/browser/ui/gtk/custom_button.h" |
18 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 19 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
19 #include "chrome/browser/ui/gtk/gtk_util.h" | 20 #include "chrome/browser/ui/gtk/gtk_util.h" |
(...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1061 if (event->button == 2) { | 1062 if (event->button == 2) { |
1062 CloseButtonClicked(); | 1063 CloseButtonClicked(); |
1063 return TRUE; | 1064 return TRUE; |
1064 } | 1065 } |
1065 | 1066 |
1066 return FALSE; | 1067 return FALSE; |
1067 } | 1068 } |
1068 | 1069 |
1069 gboolean TabRendererGtk::OnExposeEvent(GtkWidget* widget, | 1070 gboolean TabRendererGtk::OnExposeEvent(GtkWidget* widget, |
1070 GdkEventExpose* event) { | 1071 GdkEventExpose* event) { |
| 1072 TRACE_EVENT0("ui::gtk", "TabRendererGtk::OnExposeEvent"); |
| 1073 |
1071 PaintTab(widget, event); | 1074 PaintTab(widget, event); |
1072 gtk_container_propagate_expose(GTK_CONTAINER(tab_.get()), | 1075 gtk_container_propagate_expose(GTK_CONTAINER(tab_.get()), |
1073 close_button_->widget(), event); | 1076 close_button_->widget(), event); |
1074 return TRUE; | 1077 return TRUE; |
1075 } | 1078 } |
1076 | 1079 |
1077 void TabRendererGtk::OnSizeAllocate(GtkWidget* widget, | 1080 void TabRendererGtk::OnSizeAllocate(GtkWidget* widget, |
1078 GtkAllocation* allocation) { | 1081 GtkAllocation* allocation) { |
1079 gfx::Rect bounds = gfx::Rect(allocation->x, allocation->y, | 1082 gfx::Rect bounds = gfx::Rect(allocation->x, allocation->y, |
1080 allocation->width, allocation->height); | 1083 allocation->width, allocation->height); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1118 | 1121 |
1119 close_button_width_ = rb.GetBitmapNamed(IDR_TAB_CLOSE)->width(); | 1122 close_button_width_ = rb.GetBitmapNamed(IDR_TAB_CLOSE)->width(); |
1120 close_button_height_ = rb.GetBitmapNamed(IDR_TAB_CLOSE)->height(); | 1123 close_button_height_ = rb.GetBitmapNamed(IDR_TAB_CLOSE)->height(); |
1121 | 1124 |
1122 const gfx::Font& base_font = rb.GetFont(ResourceBundle::BaseFont); | 1125 const gfx::Font& base_font = rb.GetFont(ResourceBundle::BaseFont); |
1123 title_font_ = new gfx::Font(base_font.GetFontName(), kFontPixelSize); | 1126 title_font_ = new gfx::Font(base_font.GetFontName(), kFontPixelSize); |
1124 title_font_height_ = title_font_->GetHeight(); | 1127 title_font_height_ = title_font_->GetHeight(); |
1125 | 1128 |
1126 initialized_ = true; | 1129 initialized_ = true; |
1127 } | 1130 } |
OLD | NEW |