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

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

Issue 12218093: Do not cache the tab background if a tab background was autogenerated by a theme (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | 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 33beca6fb591af0e34ef5d5d6dc2b594334a1334..1a9b96159522a41aab02991480d9857add6529b9 100644
--- a/chrome/browser/ui/views/tabs/tab.cc
+++ b/chrome/browser/ui/views/tabs/tab.cc
@@ -1182,23 +1182,35 @@ void Tab::PaintInactiveTabBackgroundWithTitleChange(
void Tab::PaintInactiveTabBackground(gfx::Canvas* canvas) {
int tab_id;
+ int frame_id;
views::Widget* widget = GetWidget();
if (widget && widget->GetTopLevelWidget()->ShouldUseNativeFrame()) {
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;
#if defined(OS_WIN)
} else if (win8::IsSingleWindowMetroMode()) {
tab_id = IDR_THEME_TAB_BACKGROUND_V;
+ frame_id = 0;
#endif
} else {
tab_id = IDR_THEME_TAB_BACKGROUND;
+ frame_id = IDR_THEME_FRAME;
}
// Explicitly map the id so we cache correctly.
const chrome::HostDesktopType host_desktop_type = GetHostDesktopType(this);
tab_id = chrome::MapThemeImage(host_desktop_type, tab_id);
- const bool can_cache = !GetThemeProvider()->HasCustomImage(tab_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 theme_provided_image = theme_provider->HasCustomImage(tab_id) ||
+ (frame_id != 0 && theme_provider->HasCustomImage(frame_id));
+
+ const bool can_cache = !theme_provided_image &&
!hover_controller_.ShouldDraw();
if (can_cache) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698