| 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/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "chrome/browser/defaults.h" | 11 #include "chrome/browser/defaults.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/tab_contents/tab_contents.h" | 13 #include "chrome/browser/tab_contents/tab_contents.h" |
| 14 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
| 15 #include "chrome/browser/ui/gtk/bookmark_utils_gtk.h" | 15 #include "chrome/browser/ui/gtk/bookmark_utils_gtk.h" |
| 16 #include "chrome/browser/ui/gtk/custom_button.h" | 16 #include "chrome/browser/ui/gtk/custom_button.h" |
| 17 #include "chrome/browser/ui/gtk/gtk_theme_provider.h" | 17 #include "chrome/browser/ui/gtk/gtk_theme_provider.h" |
| 18 #include "chrome/browser/ui/gtk/gtk_util.h" | 18 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 19 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 19 #include "chrome/common/notification_service.h" | 20 #include "chrome/common/notification_service.h" |
| 20 #include "grit/app_resources.h" | 21 #include "grit/app_resources.h" |
| 21 #include "grit/generated_resources.h" | 22 #include "grit/generated_resources.h" |
| 22 #include "grit/theme_resources.h" | 23 #include "grit/theme_resources.h" |
| 23 #include "ui/base/animation/slide_animation.h" | 24 #include "ui/base/animation/slide_animation.h" |
| 24 #include "ui/base/animation/throb_animation.h" | 25 #include "ui/base/animation/throb_animation.h" |
| 25 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
| 26 #include "ui/base/resource/resource_bundle.h" | 27 #include "ui/base/resource/resource_bundle.h" |
| 27 #include "ui/gfx/canvas_skia_paint.h" | 28 #include "ui/gfx/canvas_skia_paint.h" |
| 28 #include "ui/gfx/favicon_size.h" | 29 #include "ui/gfx/favicon_size.h" |
| (...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 801 | 802 |
| 802 Paint(&canvas); | 803 Paint(&canvas); |
| 803 } | 804 } |
| 804 | 805 |
| 805 void TabRendererGtk::PaintTitle(gfx::Canvas* canvas) { | 806 void TabRendererGtk::PaintTitle(gfx::Canvas* canvas) { |
| 806 // Paint the Title. | 807 // Paint the Title. |
| 807 string16 title = data_.title; | 808 string16 title = data_.title; |
| 808 if (title.empty()) { | 809 if (title.empty()) { |
| 809 title = data_.loading ? | 810 title = data_.loading ? |
| 810 l10n_util::GetStringUTF16(IDS_TAB_LOADING_TITLE) : | 811 l10n_util::GetStringUTF16(IDS_TAB_LOADING_TITLE) : |
| 811 TabContents::GetDefaultTitle(); | 812 TabContentsWrapper::GetDefaultTitle(); |
| 812 } else { | 813 } else { |
| 813 Browser::FormatTitleForDisplay(&title); | 814 Browser::FormatTitleForDisplay(&title); |
| 814 } | 815 } |
| 815 | 816 |
| 816 SkColor title_color = IsSelected() ? selected_title_color_ | 817 SkColor title_color = IsSelected() ? selected_title_color_ |
| 817 : unselected_title_color_; | 818 : unselected_title_color_; |
| 818 canvas->DrawStringInt(title, *title_font_, title_color, | 819 canvas->DrawStringInt(title, *title_font_, title_color, |
| 819 title_bounds_.x(), title_bounds_.y(), | 820 title_bounds_.x(), title_bounds_.y(), |
| 820 title_bounds_.width(), title_bounds_.height()); | 821 title_bounds_.width(), title_bounds_.height()); |
| 821 } | 822 } |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1075 | 1076 |
| 1076 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 1077 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 1077 const gfx::Font& base_font = rb.GetFont(ResourceBundle::BaseFont); | 1078 const gfx::Font& base_font = rb.GetFont(ResourceBundle::BaseFont); |
| 1078 title_font_ = new gfx::Font(base_font.GetFontName(), kFontPixelSize); | 1079 title_font_ = new gfx::Font(base_font.GetFontName(), kFontPixelSize); |
| 1079 title_font_height_ = title_font_->GetHeight(); | 1080 title_font_height_ = title_font_->GetHeight(); |
| 1080 | 1081 |
| 1081 crashed_fav_icon = rb.GetBitmapNamed(IDR_SAD_FAVICON); | 1082 crashed_fav_icon = rb.GetBitmapNamed(IDR_SAD_FAVICON); |
| 1082 | 1083 |
| 1083 initialized_ = true; | 1084 initialized_ = true; |
| 1084 } | 1085 } |
| OLD | NEW |