Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(237)

Side by Side Diff: chrome/browser/gtk/tabs/tab_renderer_gtk.cc

Issue 2824044: Implement App Tabs for GTK (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: last cr change Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/gtk/tabs/tab_renderer_gtk.h ('k') | chrome/browser/gtk/tabs/tab_strip_gtk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/gtk/tabs/tab_renderer_gtk.h" 5 #include "chrome/browser/gtk/tabs/tab_renderer_gtk.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "app/l10n_util.h" 10 #include "app/l10n_util.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 int loading, int waiting, int waiting_to_loading) 121 int loading, int waiting, int waiting_to_loading)
122 : waiting_animation_frames(NULL), 122 : waiting_animation_frames(NULL),
123 loading_animation_frames(NULL), 123 loading_animation_frames(NULL),
124 loading_animation_frame_count(loading), 124 loading_animation_frame_count(loading),
125 waiting_animation_frame_count(waiting), 125 waiting_animation_frame_count(waiting),
126 waiting_to_loading_frame_count_ratio(waiting_to_loading) { 126 waiting_to_loading_frame_count_ratio(waiting_to_loading) {
127 } 127 }
128 128
129 bool TabRendererGtk::initialized_ = false; 129 bool TabRendererGtk::initialized_ = false;
130 TabRendererGtk::TabImage TabRendererGtk::tab_active_ = {0}; 130 TabRendererGtk::TabImage TabRendererGtk::tab_active_ = {0};
131 TabRendererGtk::TabImage TabRendererGtk::tab_active_nano_ = {0};
131 TabRendererGtk::TabImage TabRendererGtk::tab_inactive_ = {0}; 132 TabRendererGtk::TabImage TabRendererGtk::tab_inactive_ = {0};
133 TabRendererGtk::TabImage TabRendererGtk::tab_inactive_nano_ = {0};
132 TabRendererGtk::TabImage TabRendererGtk::tab_alpha_ = {0}; 134 TabRendererGtk::TabImage TabRendererGtk::tab_alpha_ = {0};
135 TabRendererGtk::TabImage TabRendererGtk::tab_alpha_nano_ = {0};
133 gfx::Font* TabRendererGtk::title_font_ = NULL; 136 gfx::Font* TabRendererGtk::title_font_ = NULL;
134 int TabRendererGtk::title_font_height_ = 0; 137 int TabRendererGtk::title_font_height_ = 0;
135 int TabRendererGtk::close_button_width_ = 0; 138 int TabRendererGtk::close_button_width_ = 0;
136 int TabRendererGtk::close_button_height_ = 0; 139 int TabRendererGtk::close_button_height_ = 0;
137 SkColor TabRendererGtk::selected_title_color_ = SK_ColorBLACK; 140 SkColor TabRendererGtk::selected_title_color_ = SK_ColorBLACK;
138 SkColor TabRendererGtk::unselected_title_color_ = SkColorSetRGB(64, 64, 64); 141 SkColor TabRendererGtk::unselected_title_color_ = SkColorSetRGB(64, 64, 64);
139 142
140 //////////////////////////////////////////////////////////////////////////////// 143 ////////////////////////////////////////////////////////////////////////////////
141 // TabRendererGtk::LoadingAnimation, public: 144 // TabRendererGtk::LoadingAnimation, public:
142 // 145 //
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 TabRendererGtk::~TabRendererGtk() { 271 TabRendererGtk::~TabRendererGtk() {
269 tab_.Destroy(); 272 tab_.Destroy();
270 for (BitmapCache::iterator it = cached_bitmaps_.begin(); 273 for (BitmapCache::iterator it = cached_bitmaps_.begin();
271 it != cached_bitmaps_.end(); ++it) { 274 it != cached_bitmaps_.end(); ++it) {
272 delete it->second.bitmap; 275 delete it->second.bitmap;
273 } 276 }
274 } 277 }
275 278
276 void TabRendererGtk::UpdateData(TabContents* contents, 279 void TabRendererGtk::UpdateData(TabContents* contents,
277 bool phantom, 280 bool phantom,
281 bool app,
278 bool loading_only) { 282 bool loading_only) {
279 DCHECK(contents); 283 DCHECK(contents);
280
281 theme_provider_ = GtkThemeProvider::GetFrom(contents->profile()); 284 theme_provider_ = GtkThemeProvider::GetFrom(contents->profile());
282 285
283 if (!loading_only) { 286 if (!loading_only) {
284 data_.title = contents->GetTitle(); 287 data_.title = contents->GetTitle();
285 data_.off_the_record = contents->profile()->IsOffTheRecord(); 288 data_.off_the_record = contents->profile()->IsOffTheRecord();
286 data_.crashed = contents->is_crashed(); 289 data_.crashed = contents->is_crashed();
287 data_.favicon = contents->GetFavIcon(); 290
291 SkBitmap* app_icon = contents->GetExtensionAppIcon();
292 if (app_icon)
293 data_.favicon = *app_icon;
294 else
295 data_.favicon = contents->GetFavIcon();
296
288 data_.phantom = phantom; 297 data_.phantom = phantom;
298 data_.app = app;
289 // This is kind of a hacky way to determine whether our icon is the default 299 // This is kind of a hacky way to determine whether our icon is the default
290 // favicon. But the plumbing that would be necessary to do it right would 300 // favicon. But the plumbing that would be necessary to do it right would
291 // be a good bit of work and would sully code for other platforms which 301 // be a good bit of work and would sully code for other platforms which
292 // don't care to custom-theme the favicon. Hopefully the default favicon 302 // don't care to custom-theme the favicon. Hopefully the default favicon
293 // will eventually be chromium-themable and this code will go away. 303 // will eventually be chromium-themable and this code will go away.
294 data_.is_default_favicon = 304 data_.is_default_favicon =
295 (data_.favicon.pixelRef() == 305 (data_.favicon.pixelRef() ==
296 ResourceBundle::GetSharedInstance().GetBitmapNamed( 306 ResourceBundle::GetSharedInstance().GetBitmapNamed(
297 IDR_DEFAULT_FAVICON)->pixelRef()); 307 IDR_DEFAULT_FAVICON)->pixelRef());
298 } 308 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 theme_id = IDR_THEME_TOOLBAR; 384 theme_id = IDR_THEME_TOOLBAR;
375 } else { 385 } else {
376 if (!data_.off_the_record) { 386 if (!data_.off_the_record) {
377 theme_id = IDR_THEME_TAB_BACKGROUND; 387 theme_id = IDR_THEME_TAB_BACKGROUND;
378 } else { 388 } else {
379 theme_id = IDR_THEME_TAB_BACKGROUND_INCOGNITO; 389 theme_id = IDR_THEME_TAB_BACKGROUND_INCOGNITO;
380 } 390 }
381 if (!theme_provider_->HasCustomImage(theme_id)) 391 if (!theme_provider_->HasCustomImage(theme_id))
382 offset_y = background_offset_y_; 392 offset_y = background_offset_y_;
383 } 393 }
394
395 // If the tab is a nanotab, we must take care to only draw the background
396 // within the height of the nanotab.
397 int nanoTabOffset = data_.app ? 9 : 0;
384 SkBitmap* tab_bg = theme_provider_->GetBitmapNamed(theme_id); 398 SkBitmap* tab_bg = theme_provider_->GetBitmapNamed(theme_id);
385 canvas.TileImageInt(*tab_bg, 399 canvas.TileImageInt(*tab_bg,
386 x() + favicon_bounds_.x(), offset_y + favicon_bounds_.y(), 400 x() + favicon_bounds_.x(),
387 favicon_bounds_.x(), favicon_bounds_.y(), 401 offset_y + favicon_bounds_.y() + nanoTabOffset,
388 favicon_bounds_.width(), favicon_bounds_.height()); 402 favicon_bounds_.x(),
403 favicon_bounds_.y() + nanoTabOffset,
404 favicon_bounds_.width(),
405 favicon_bounds_.height() - nanoTabOffset);
389 406
390 if (!IsSelected()) { 407 if (!IsSelected()) {
391 double throb_value = GetThrobValue(); 408 double throb_value = GetThrobValue();
392 if (throb_value > 0) { 409 if (throb_value > 0) {
393 SkRect bounds; 410 SkRect bounds;
394 bounds.set(favicon_bounds_.x(), favicon_bounds_.y(), 411 bounds.set(favicon_bounds_.x(), favicon_bounds_.y(),
395 favicon_bounds_.right(), favicon_bounds_.bottom()); 412 favicon_bounds_.right(), favicon_bounds_.bottom());
396 canvas.saveLayerAlpha(&bounds, static_cast<int>(throb_value * 0xff), 413 canvas.saveLayerAlpha(&bounds, static_cast<int>(throb_value * 0xff),
397 SkCanvas::kARGB_ClipLayer_SaveFlag); 414 SkCanvas::kARGB_ClipLayer_SaveFlag);
398 canvas.drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode); 415 canvas.drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 return std::max(content_height, close_button_height_); 465 return std::max(content_height, close_button_height_);
449 } 466 }
450 467
451 // static 468 // static
452 void TabRendererGtk::LoadTabImages() { 469 void TabRendererGtk::LoadTabImages() {
453 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 470 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
454 471
455 tab_alpha_.image_l = rb.GetBitmapNamed(IDR_TAB_ALPHA_LEFT); 472 tab_alpha_.image_l = rb.GetBitmapNamed(IDR_TAB_ALPHA_LEFT);
456 tab_alpha_.image_r = rb.GetBitmapNamed(IDR_TAB_ALPHA_RIGHT); 473 tab_alpha_.image_r = rb.GetBitmapNamed(IDR_TAB_ALPHA_RIGHT);
457 474
475 tab_alpha_nano_.image_l = rb.GetBitmapNamed(IDR_TAB_ALPHA_NANO_LEFT);
476 tab_alpha_nano_.image_r = rb.GetBitmapNamed(IDR_TAB_ALPHA_NANO_RIGHT);
477
458 tab_active_.image_l = rb.GetBitmapNamed(IDR_TAB_ACTIVE_LEFT); 478 tab_active_.image_l = rb.GetBitmapNamed(IDR_TAB_ACTIVE_LEFT);
459 tab_active_.image_c = rb.GetBitmapNamed(IDR_TAB_ACTIVE_CENTER); 479 tab_active_.image_c = rb.GetBitmapNamed(IDR_TAB_ACTIVE_CENTER);
460 tab_active_.image_r = rb.GetBitmapNamed(IDR_TAB_ACTIVE_RIGHT); 480 tab_active_.image_r = rb.GetBitmapNamed(IDR_TAB_ACTIVE_RIGHT);
461 tab_active_.l_width = tab_active_.image_l->width(); 481 tab_active_.l_width = tab_active_.image_l->width();
462 tab_active_.r_width = tab_active_.image_r->width(); 482 tab_active_.r_width = tab_active_.image_r->width();
463 483
484 const int kNanoTabDiffHeight = 13;
485
486 tab_active_nano_.image_l = rb.GetBitmapNamed(IDR_TAB_ACTIVE_NANO_LEFT);
487 tab_active_nano_.image_c = rb.GetBitmapNamed(IDR_TAB_ACTIVE_NANO_CENTER);
488 tab_active_nano_.image_r = rb.GetBitmapNamed(IDR_TAB_ACTIVE_NANO_RIGHT);
489 tab_active_nano_.l_width = tab_active_nano_.image_l->width();
490 tab_active_nano_.r_width = tab_active_nano_.image_r->width();
491 tab_active_nano_.y_offset = kNanoTabDiffHeight;
492
464 tab_inactive_.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT); 493 tab_inactive_.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT);
465 tab_inactive_.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER); 494 tab_inactive_.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER);
466 tab_inactive_.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT); 495 tab_inactive_.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT);
467 tab_inactive_.l_width = tab_inactive_.image_l->width(); 496 tab_inactive_.l_width = tab_inactive_.image_l->width();
468 tab_inactive_.r_width = tab_inactive_.image_r->width(); 497 tab_inactive_.r_width = tab_inactive_.image_r->width();
469 498
499 tab_inactive_nano_.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_NANO_LEFT);
500 tab_inactive_nano_.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_NANO_CENTER);
501 tab_inactive_nano_.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_NANO_RIGHT);
502 tab_inactive_nano_.l_width = tab_inactive_.image_l->width();
503 tab_inactive_nano_.r_width = tab_inactive_.image_r->width();
504 tab_inactive_nano_.y_offset = kNanoTabDiffHeight;
505
470 close_button_width_ = rb.GetBitmapNamed(IDR_TAB_CLOSE)->width(); 506 close_button_width_ = rb.GetBitmapNamed(IDR_TAB_CLOSE)->width();
471 close_button_height_ = rb.GetBitmapNamed(IDR_TAB_CLOSE)->height(); 507 close_button_height_ = rb.GetBitmapNamed(IDR_TAB_CLOSE)->height();
472 } 508 }
473 509
474 // static 510 // static
475 void TabRendererGtk::SetSelectedTitleColor(SkColor color) { 511 void TabRendererGtk::SetSelectedTitleColor(SkColor color) {
476 selected_title_color_ = color; 512 selected_title_color_ = color;
477 } 513 }
478 514
479 // static 515 // static
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 kFavIconSize, kFavIconSize, 851 kFavIconSize, kFavIconSize,
816 true); 852 true);
817 } else { 853 } else {
818 if (!data_.favicon.isNull()) { 854 if (!data_.favicon.isNull()) {
819 if (data_.is_default_favicon && theme_provider_->UseGtkTheme()) { 855 if (data_.is_default_favicon && theme_provider_->UseGtkTheme()) {
820 GdkPixbuf* favicon = GtkThemeProvider::GetDefaultFavicon(true); 856 GdkPixbuf* favicon = GtkThemeProvider::GetDefaultFavicon(true);
821 canvas->AsCanvasSkia()->DrawGdkPixbuf( 857 canvas->AsCanvasSkia()->DrawGdkPixbuf(
822 favicon, favicon_bounds_.x(), 858 favicon, favicon_bounds_.x(),
823 favicon_bounds_.y() + fav_icon_hiding_offset_); 859 favicon_bounds_.y() + fav_icon_hiding_offset_);
824 } else { 860 } else {
861 // If the favicon is an app icon, it is allowed to be drawn slightly
862 // larger than the standard favicon.
863 int favIconHeightOffset = data_.app ? -2 : 0;
864 int favIconWidthDelta = data_.app ?
865 data_.favicon.width() - kFavIconSize : 0;
866 int favIconHeightDelta = data_.app ?
867 data_.favicon.height() - kFavIconSize : 0;
868
825 // TODO(pkasting): Use code in tab_icon_view.cc:PaintIcon() (or switch 869 // TODO(pkasting): Use code in tab_icon_view.cc:PaintIcon() (or switch
826 // to using that class to render the favicon). 870 // to using that class to render the favicon).
827 canvas->DrawBitmapInt(data_.favicon, 0, 0, 871 canvas->DrawBitmapInt(data_.favicon, 0, 0,
828 data_.favicon.width(), 872 data_.favicon.width(),
829 data_.favicon.height(), 873 data_.favicon.height(),
830 favicon_bounds_.x(), 874 favicon_bounds_.x() - favIconWidthDelta/2,
831 favicon_bounds_.y() + fav_icon_hiding_offset_, 875 favicon_bounds_.y() + favIconHeightOffset
832 kFavIconSize, kFavIconSize, 876 - favIconHeightDelta/2
877 + fav_icon_hiding_offset_,
878 kFavIconSize + favIconWidthDelta,
879 kFavIconSize + favIconHeightDelta,
833 true); 880 true);
834 } 881 }
835 } 882 }
836 } 883 }
837 canvas->Restore(); 884 canvas->Restore();
838 } 885 }
839 } 886 }
840 887
841 void TabRendererGtk::PaintTabBackground(gfx::Canvas* canvas) { 888 void TabRendererGtk::PaintTabBackground(gfx::Canvas* canvas) {
842 if (IsSelected()) { 889 if (IsSelected()) {
(...skipping 18 matching lines...) Expand all
861 908
862 // The tab image needs to be lined up with the background image 909 // The tab image needs to be lined up with the background image
863 // so that it feels partially transparent. 910 // so that it feels partially transparent.
864 int offset_x = background_offset_x_; 911 int offset_x = background_offset_x_;
865 912
866 int tab_id = is_otr ? 913 int tab_id = is_otr ?
867 IDR_THEME_TAB_BACKGROUND_INCOGNITO : IDR_THEME_TAB_BACKGROUND; 914 IDR_THEME_TAB_BACKGROUND_INCOGNITO : IDR_THEME_TAB_BACKGROUND;
868 915
869 SkBitmap* tab_bg = theme_provider_->GetBitmapNamed(tab_id); 916 SkBitmap* tab_bg = theme_provider_->GetBitmapNamed(tab_id);
870 917
918 // App tabs are drawn slightly differently (as nano tabs).
919 TabImage* tab_image = data_.app ? &tab_active_nano_ : &tab_active_;
920 TabImage* tab_inactive_image = data_.app ? &tab_inactive_nano_ :
921 &tab_inactive_;
922 TabImage* alpha = data_.app ? &tab_alpha_nano_ : &tab_alpha_;
923
871 // If the theme is providing a custom background image, then its top edge 924 // If the theme is providing a custom background image, then its top edge
872 // should be at the top of the tab. Otherwise, we assume that the background 925 // should be at the top of the tab. Otherwise, we assume that the background
873 // image is a composited foreground + frame image. 926 // image is a composited foreground + frame image.
874 int offset_y = theme_provider_->HasCustomImage(tab_id) ? 927 int offset_y = theme_provider_->HasCustomImage(tab_id) ?
875 0 : background_offset_y_; 928 0 : background_offset_y_;
876 929
877 // Draw left edge. 930 // Draw left edge.
878 SkBitmap* theme_l = GetMaskedBitmap(tab_alpha_.image_l, tab_bg, offset_x, 931 SkBitmap* theme_l = GetMaskedBitmap(alpha->image_l, tab_bg, offset_x,
879 offset_y); 932 offset_y);
880 canvas->DrawBitmapInt(*theme_l, 0, 0); 933 canvas->DrawBitmapInt(*theme_l, 0, 0);
881 934
882 // Draw right edge. 935 // Draw right edge.
883 SkBitmap* theme_r = GetMaskedBitmap(tab_alpha_.image_r, tab_bg, 936 SkBitmap* theme_r = GetMaskedBitmap(alpha->image_r, tab_bg,
884 offset_x + width() - tab_active_.r_width, offset_y); 937 offset_x + width() - tab_image->r_width, offset_y);
885 938
886 canvas->DrawBitmapInt(*theme_r, width() - theme_r->width(), 0); 939 canvas->DrawBitmapInt(*theme_r, width() - theme_r->width(), 0);
887 940
888 // Draw center. 941 // Draw center.
889 canvas->TileImageInt(*tab_bg, 942 canvas->TileImageInt(
890 offset_x + tab_active_.l_width, kDropShadowOffset + offset_y, 943 *tab_bg,
891 tab_active_.l_width, 2, 944 offset_x + tab_image->l_width,
892 width() - tab_active_.l_width - tab_active_.r_width, height() - 2); 945 kDropShadowOffset + offset_y + tab_image->y_offset,
946 tab_image->l_width,
947 kDropShadowHeight + tab_image->y_offset,
948 width() - tab_image->l_width - tab_image->r_width,
949 height() - kDropShadowHeight - tab_image->y_offset);
893 950
894 canvas->DrawBitmapInt(*tab_inactive_.image_l, 0, 0); 951 canvas->DrawBitmapInt(*tab_inactive_image->image_l, 0, 0);
895 canvas->TileImageInt(*tab_inactive_.image_c, tab_inactive_.l_width, 0, 952 canvas->TileImageInt(
896 width() - tab_inactive_.l_width - tab_inactive_.r_width, height()); 953 *tab_inactive_image->image_c,
897 canvas->DrawBitmapInt(*tab_inactive_.image_r, 954 tab_inactive_image->l_width,
898 width() - tab_inactive_.r_width, 0); 955 0,
956 width() - tab_inactive_image->l_width - tab_inactive_image->r_width,
957 height());
958 canvas->DrawBitmapInt(*tab_inactive_image->image_r,
959 width() - tab_inactive_image->r_width, 0);
899 } 960 }
900 961
901 void TabRendererGtk::PaintActiveTabBackground(gfx::Canvas* canvas) { 962 void TabRendererGtk::PaintActiveTabBackground(gfx::Canvas* canvas) {
902 int offset_x = background_offset_x_; 963 int offset_x = background_offset_x_;
903 964
904 SkBitmap* tab_bg = theme_provider_->GetBitmapNamed(IDR_THEME_TOOLBAR); 965 SkBitmap* tab_bg = theme_provider_->GetBitmapNamed(IDR_THEME_TOOLBAR);
905 966
967 // App tabs are drawn slightly differently (as nano tabs).
968 TabImage* tab_image = data_.app ? &tab_active_nano_ : &tab_active_;
969 TabImage* alpha = data_.app ? &tab_alpha_nano_ : &tab_alpha_;
970
906 // Draw left edge. 971 // Draw left edge.
907 SkBitmap* theme_l = GetMaskedBitmap(tab_alpha_.image_l, tab_bg, offset_x, 0); 972 SkBitmap* theme_l = GetMaskedBitmap(alpha->image_l, tab_bg, offset_x, 0);
908 canvas->DrawBitmapInt(*theme_l, 0, 0); 973 canvas->DrawBitmapInt(*theme_l, 0, 0);
909 974
910 // Draw right edge. 975 // Draw right edge.
911 SkBitmap* theme_r = GetMaskedBitmap(tab_alpha_.image_r, tab_bg, 976 SkBitmap* theme_r = GetMaskedBitmap(alpha->image_r, tab_bg,
912 offset_x + width() - tab_active_.r_width, 0); 977 offset_x + width() - tab_image->r_width, 0);
913 canvas->DrawBitmapInt(*theme_r, width() - tab_active_.r_width, 0); 978 canvas->DrawBitmapInt(*theme_r, width() - tab_image->r_width, 0);
914 979
915 // Draw center. 980 // Draw center.
916 canvas->TileImageInt(*tab_bg, 981 canvas->TileImageInt(*tab_bg,
917 offset_x + tab_active_.l_width, kDropShadowHeight, 982 offset_x + tab_image->l_width,
918 tab_active_.l_width, kDropShadowHeight, 983 kDropShadowHeight + tab_image->y_offset,
919 width() - tab_active_.l_width - tab_active_.r_width, 984 tab_image->l_width,
920 height() - kDropShadowHeight); 985 kDropShadowHeight + tab_image->y_offset,
986 width() - tab_image->l_width - tab_image->r_width,
987 height() - kDropShadowHeight - tab_image->y_offset);
921 988
922 canvas->DrawBitmapInt(*tab_active_.image_l, 0, 0); 989 canvas->DrawBitmapInt(*tab_image->image_l, 0, 0);
923 canvas->TileImageInt(*tab_active_.image_c, tab_active_.l_width, 0, 990 canvas->TileImageInt(*tab_image->image_c, tab_image->l_width, 0,
924 width() - tab_active_.l_width - tab_active_.r_width, height()); 991 width() - tab_image->l_width - tab_image->r_width, height());
925 canvas->DrawBitmapInt(*tab_active_.image_r, width() - tab_active_.r_width, 0); 992 canvas->DrawBitmapInt(*tab_image->image_r, width() - tab_image->r_width, 0);
926 } 993 }
927 994
928 void TabRendererGtk::PaintLoadingAnimation(gfx::Canvas* canvas) { 995 void TabRendererGtk::PaintLoadingAnimation(gfx::Canvas* canvas) {
929 const SkBitmap* frames = 996 const SkBitmap* frames =
930 (loading_animation_.animation_state() == ANIMATION_WAITING) ? 997 (loading_animation_.animation_state() == ANIMATION_WAITING) ?
931 loading_animation_.waiting_animation_frames() : 998 loading_animation_.waiting_animation_frames() :
932 loading_animation_.loading_animation_frames(); 999 loading_animation_.loading_animation_frames();
933 const int image_size = frames->height(); 1000 const int image_size = frames->height();
934 const int image_offset = loading_animation_.animation_frame() * image_size; 1001 const int image_offset = loading_animation_.animation_frame() * image_size;
935 DCHECK(image_size == favicon_bounds_.height()); 1002 DCHECK(image_size == favicon_bounds_.height());
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
1059 // Force the font size to 9pt, which matches Windows' default font size 1126 // Force the font size to 9pt, which matches Windows' default font size
1060 // (taken from the system). 1127 // (taken from the system).
1061 const gfx::Font& base_font = rb.GetFont(ResourceBundle::BaseFont); 1128 const gfx::Font& base_font = rb.GetFont(ResourceBundle::BaseFont);
1062 title_font_ = new gfx::Font(gfx::Font::CreateFont(base_font.FontName(), 9)); 1129 title_font_ = new gfx::Font(gfx::Font::CreateFont(base_font.FontName(), 9));
1063 title_font_height_ = title_font_->height(); 1130 title_font_height_ = title_font_->height();
1064 1131
1065 crashed_fav_icon = rb.GetBitmapNamed(IDR_SAD_FAVICON); 1132 crashed_fav_icon = rb.GetBitmapNamed(IDR_SAD_FAVICON);
1066 1133
1067 initialized_ = true; 1134 initialized_ = true;
1068 } 1135 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/tabs/tab_renderer_gtk.h ('k') | chrome/browser/gtk/tabs/tab_strip_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698