| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/debug/trace_event.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "content/public/browser/notification_source.h" | 24 #include "content/public/browser/notification_source.h" |
| 25 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
| 26 #include "grit/generated_resources.h" | 26 #include "grit/generated_resources.h" |
| 27 #include "grit/theme_resources.h" | 27 #include "grit/theme_resources.h" |
| 28 #include "grit/theme_resources_standard.h" | 28 #include "grit/theme_resources_standard.h" |
| 29 #include "grit/ui_resources.h" | 29 #include "grit/ui_resources.h" |
| 30 #include "skia/ext/image_operations.h" | 30 #include "skia/ext/image_operations.h" |
| 31 #include "ui/base/animation/slide_animation.h" | 31 #include "ui/base/animation/slide_animation.h" |
| 32 #include "ui/base/animation/throb_animation.h" | 32 #include "ui/base/animation/throb_animation.h" |
| 33 #include "ui/base/gtk/gtk_compat.h" | 33 #include "ui/base/gtk/gtk_compat.h" |
| 34 #include "ui/base/gtk/gtk_screen_util.h" |
| 34 #include "ui/base/l10n/l10n_util.h" | 35 #include "ui/base/l10n/l10n_util.h" |
| 35 #include "ui/base/resource/resource_bundle.h" | 36 #include "ui/base/resource/resource_bundle.h" |
| 36 #include "ui/gfx/canvas_skia_paint.h" | 37 #include "ui/gfx/canvas_skia_paint.h" |
| 37 #include "ui/gfx/favicon_size.h" | 38 #include "ui/gfx/favicon_size.h" |
| 38 #include "ui/gfx/gtk_util.h" | 39 #include "ui/gfx/gtk_util.h" |
| 39 #include "ui/gfx/image/cairo_cached_surface.h" | 40 #include "ui/gfx/image/cairo_cached_surface.h" |
| 40 #include "ui/gfx/image/image.h" | 41 #include "ui/gfx/image/image.h" |
| 41 #include "ui/gfx/pango_util.h" | 42 #include "ui/gfx/pango_util.h" |
| 42 #include "ui/gfx/platform_font_pango.h" | 43 #include "ui/gfx/platform_font_pango.h" |
| 43 #include "ui/gfx/skbitmap_operations.h" | 44 #include "ui/gfx/skbitmap_operations.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 const int kMiniTitleChangeThrobDuration = 1000; | 90 const int kMiniTitleChangeThrobDuration = 1000; |
| 90 | 91 |
| 91 // The vertical and horizontal offset used to position the close button | 92 // The vertical and horizontal offset used to position the close button |
| 92 // in the tab. TODO(jhawkins): Ask pkasting what the Fuzz is about. | 93 // in the tab. TODO(jhawkins): Ask pkasting what the Fuzz is about. |
| 93 const int kCloseButtonVertFuzz = 0; | 94 const int kCloseButtonVertFuzz = 0; |
| 94 const int kCloseButtonHorzFuzz = 5; | 95 const int kCloseButtonHorzFuzz = 5; |
| 95 | 96 |
| 96 // Gets the bounds of |widget| relative to |parent|. | 97 // Gets the bounds of |widget| relative to |parent|. |
| 97 gfx::Rect GetWidgetBoundsRelativeToParent(GtkWidget* parent, | 98 gfx::Rect GetWidgetBoundsRelativeToParent(GtkWidget* parent, |
| 98 GtkWidget* widget) { | 99 GtkWidget* widget) { |
| 99 gfx::Point parent_pos = gtk_util::GetWidgetScreenPosition(parent); | 100 gfx::Point parent_pos = ui::GetWidgetScreenPosition(parent); |
| 100 gfx::Point widget_pos = gtk_util::GetWidgetScreenPosition(widget); | 101 gfx::Point widget_pos = ui::GetWidgetScreenPosition(widget); |
| 101 | 102 |
| 102 GtkAllocation allocation; | 103 GtkAllocation allocation; |
| 103 gtk_widget_get_allocation(widget, &allocation); | 104 gtk_widget_get_allocation(widget, &allocation); |
| 104 | 105 |
| 105 return gfx::Rect(widget_pos.x() - parent_pos.x(), | 106 return gfx::Rect(widget_pos.x() - parent_pos.x(), |
| 106 widget_pos.y() - parent_pos.y(), | 107 widget_pos.y() - parent_pos.y(), |
| 107 allocation.width, allocation.height); | 108 allocation.width, allocation.height); |
| 108 } | 109 } |
| 109 | 110 |
| 110 } // namespace | 111 } // namespace |
| (...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1122 | 1123 |
| 1123 close_button_width_ = rb.GetBitmapNamed(IDR_TAB_CLOSE)->width(); | 1124 close_button_width_ = rb.GetBitmapNamed(IDR_TAB_CLOSE)->width(); |
| 1124 close_button_height_ = rb.GetBitmapNamed(IDR_TAB_CLOSE)->height(); | 1125 close_button_height_ = rb.GetBitmapNamed(IDR_TAB_CLOSE)->height(); |
| 1125 | 1126 |
| 1126 const gfx::Font& base_font = rb.GetFont(ui::ResourceBundle::BaseFont); | 1127 const gfx::Font& base_font = rb.GetFont(ui::ResourceBundle::BaseFont); |
| 1127 title_font_ = new gfx::Font(base_font.GetFontName(), kFontPixelSize); | 1128 title_font_ = new gfx::Font(base_font.GetFontName(), kFontPixelSize); |
| 1128 title_font_height_ = title_font_->GetHeight(); | 1129 title_font_height_ = title_font_->GetHeight(); |
| 1129 | 1130 |
| 1130 initialized_ = true; | 1131 initialized_ = true; |
| 1131 } | 1132 } |
| OLD | NEW |