| OLD | NEW |
| 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/ui/views/tabs/tab.h" | 5 #include "chrome/browser/ui/views/tabs/tab.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/defaults.h" | 10 #include "chrome/browser/defaults.h" |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 if (!close_button_color_ || title_color != close_button_color_) { | 205 if (!close_button_color_ || title_color != close_button_color_) { |
| 206 close_button_color_ = title_color; | 206 close_button_color_ = title_color; |
| 207 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 207 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 208 close_button()->SetBackground(close_button_color_, | 208 close_button()->SetBackground(close_button_color_, |
| 209 rb.GetBitmapNamed(IDR_TAB_CLOSE), | 209 rb.GetBitmapNamed(IDR_TAB_CLOSE), |
| 210 rb.GetBitmapNamed(IDR_TAB_CLOSE_MASK)); | 210 rb.GetBitmapNamed(IDR_TAB_CLOSE_MASK)); |
| 211 } | 211 } |
| 212 } | 212 } |
| 213 | 213 |
| 214 void Tab::Layout() { | 214 void Tab::Layout() { |
| 215 gfx::Rect lb = GetLocalBounds(); | 215 gfx::Rect lb = GetContentsBounds(); |
| 216 if (lb.IsEmpty()) | 216 if (lb.IsEmpty()) |
| 217 return; | 217 return; |
| 218 lb.Inset(kLeftPadding, kTopPadding, kRightPadding, kBottomPadding); | 218 lb.Inset(kLeftPadding, kTopPadding, kRightPadding, kBottomPadding); |
| 219 | 219 |
| 220 // The height of the content of the Tab is the largest of the favicon, | 220 // The height of the content of the Tab is the largest of the favicon, |
| 221 // the title text and the close button graphic. | 221 // the title text and the close button graphic. |
| 222 int content_height = std::max(kFavIconSize, font_height()); | 222 int content_height = std::max(kFavIconSize, font_height()); |
| 223 gfx::Size close_button_size(close_button()->GetPreferredSize()); | 223 gfx::Size close_button_size(close_button()->GetPreferredSize()); |
| 224 content_height = std::max(content_height, close_button_size.height()); | 224 content_height = std::max(content_height, close_button_size.height()); |
| 225 | 225 |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 tab_active_.image_r = rb.GetBitmapNamed(IDR_TAB_ACTIVE_RIGHT); | 665 tab_active_.image_r = rb.GetBitmapNamed(IDR_TAB_ACTIVE_RIGHT); |
| 666 tab_active_.l_width = tab_active_.image_l->width(); | 666 tab_active_.l_width = tab_active_.image_l->width(); |
| 667 tab_active_.r_width = tab_active_.image_r->width(); | 667 tab_active_.r_width = tab_active_.image_r->width(); |
| 668 | 668 |
| 669 tab_inactive_.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT); | 669 tab_inactive_.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT); |
| 670 tab_inactive_.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER); | 670 tab_inactive_.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER); |
| 671 tab_inactive_.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT); | 671 tab_inactive_.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT); |
| 672 tab_inactive_.l_width = tab_inactive_.image_l->width(); | 672 tab_inactive_.l_width = tab_inactive_.image_l->width(); |
| 673 tab_inactive_.r_width = tab_inactive_.image_r->width(); | 673 tab_inactive_.r_width = tab_inactive_.image_r->width(); |
| 674 } | 674 } |
| OLD | NEW |