Commit a9d32609 authored by pkotwicz@chromium.org's avatar pkotwicz@chromium.org

Do not cache the tab background if a tab background was autogenerated by a theme

BUG=175426
Test=None

Review URL: https://chromiumcodereview.appspot.com/12218093

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@182095 0039d316-1c4b-4281-b951-d872f2087c98
parent 635fa9cd
...@@ -1182,23 +1182,35 @@ void Tab::PaintInactiveTabBackgroundWithTitleChange( ...@@ -1182,23 +1182,35 @@ void Tab::PaintInactiveTabBackgroundWithTitleChange(
void Tab::PaintInactiveTabBackground(gfx::Canvas* canvas) { void Tab::PaintInactiveTabBackground(gfx::Canvas* canvas) {
int tab_id; int tab_id;
int frame_id;
views::Widget* widget = GetWidget(); views::Widget* widget = GetWidget();
if (widget && widget->GetTopLevelWidget()->ShouldUseNativeFrame()) { if (widget && widget->GetTopLevelWidget()->ShouldUseNativeFrame()) {
tab_id = IDR_THEME_TAB_BACKGROUND_V; tab_id = IDR_THEME_TAB_BACKGROUND_V;
frame_id = 0;
} else if (data().incognito) { } else if (data().incognito) {
tab_id = IDR_THEME_TAB_BACKGROUND_INCOGNITO; tab_id = IDR_THEME_TAB_BACKGROUND_INCOGNITO;
frame_id = IDR_THEME_FRAME_INCOGNITO;
#if defined(OS_WIN) #if defined(OS_WIN)
} else if (win8::IsSingleWindowMetroMode()) { } else if (win8::IsSingleWindowMetroMode()) {
tab_id = IDR_THEME_TAB_BACKGROUND_V; tab_id = IDR_THEME_TAB_BACKGROUND_V;
frame_id = 0;
#endif #endif
} else { } else {
tab_id = IDR_THEME_TAB_BACKGROUND; tab_id = IDR_THEME_TAB_BACKGROUND;
frame_id = IDR_THEME_FRAME;
} }
// Explicitly map the id so we cache correctly. // Explicitly map the id so we cache correctly.
const chrome::HostDesktopType host_desktop_type = GetHostDesktopType(this); const chrome::HostDesktopType host_desktop_type = GetHostDesktopType(this);
tab_id = chrome::MapThemeImage(host_desktop_type, tab_id); 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(); !hover_controller_.ShouldDraw();
if (can_cache) { if (can_cache) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment