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

Unified Diff: chrome/browser/ui/views/tabs/tab.cc

Issue 1424913008: Combine tab background image getter code into one place. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@combine_tab_drawing
Patch Set: Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/tabs/tab.h ('k') | chrome/browser/ui/views/tabs/tab_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/tabs/tab.cc
diff --git a/chrome/browser/ui/views/tabs/tab.cc b/chrome/browser/ui/views/tabs/tab.cc
index 41a3df072559902986eb4a207560d23a7c79c365..c2cc048a959689770ccdd99efc42c4fedef2fd9c 100644
--- a/chrome/browser/ui/views/tabs/tab.cc
+++ b/chrome/browser/ui/views/tabs/tab.cc
@@ -1179,15 +1179,8 @@ void Tab::PaintInactiveTabBackgroundWithTitleChange(gfx::Canvas* canvas) {
}
void Tab::PaintInactiveTabBackground(gfx::Canvas* canvas) {
- int fill_id, frame_id;
- GetTabIdAndFrameId(GetWidget(), &fill_id, &frame_id);
- // HasCustomImage() is only true if the theme provides the image. However,
- // even if the theme does not provide a tab background, the theme machinery
- // will make one if given a frame image.
- ui::ThemeProvider* theme_provider = GetThemeProvider();
- const bool has_custom_image = theme_provider->HasCustomImage(fill_id) ||
- (frame_id != 0 && theme_provider->HasCustomImage(frame_id));
-
+ bool has_custom_image;
+ int fill_id = controller_->GetBackgroundResourceId(&has_custom_image);
// Explicitly map the id so we cache correctly.
const chrome::HostDesktopType host_desktop_type = GetHostDesktopType(this);
fill_id = chrome::MapThemeImage(host_desktop_type, fill_id);
@@ -1491,22 +1484,6 @@ gfx::Rect Tab::GetImmersiveBarRect() const {
main_bar_left, 0, main_bar_right - main_bar_left, kImmersiveBarHeight);
}
-void Tab::GetTabIdAndFrameId(views::Widget* widget,
- int* tab_id,
- int* frame_id) const {
- if (widget &&
- widget->GetTopLevelWidget()->ShouldWindowContentsBeTransparent()) {
- *tab_id = IDR_THEME_TAB_BACKGROUND_V;
- *frame_id = 0;
- } else if (data().incognito) {
- *tab_id = IDR_THEME_TAB_BACKGROUND_INCOGNITO;
- *frame_id = IDR_THEME_FRAME_INCOGNITO;
- } else {
- *tab_id = IDR_THEME_TAB_BACKGROUND;
- *frame_id = IDR_THEME_FRAME;
- }
-}
-
////////////////////////////////////////////////////////////////////////////////
// Tab, private static:
« no previous file with comments | « chrome/browser/ui/views/tabs/tab.h ('k') | chrome/browser/ui/views/tabs/tab_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698