Commit 5cc5609d authored by estade's avatar estade Committed by Commit bot

Remove some theme images that are not used any more.

These aren't used by the default theme, which renders programmatically
or with colors. (For example, the ntp background image was a 42x42
white square, but we don't need it because we set the bg color to
white.)

I left the IDR_s in place because they're still needed to identify
custom theme images. We could replace them with a C++ enum, but since
they occupy the same namespace as other themed/not-themed images (ints),
leaving them here seems the best way to avoid potential collisions.

BUG=522168

Review-Url: https://codereview.chromium.org/2568403004
Cr-Commit-Position: refs/heads/master@{#438989}
parent fabb27e9
......@@ -558,30 +558,17 @@
<structure type="chrome_scaled_image" name="IDR_TECHNICAL_ERROR" file="cros/technical_error.png" />
</if>
<structure type="chrome_scaled_image" name="IDR_THEME_BUTTON_BACKGROUND" file="notused.png" />
<if expr="not use_ash">
<structure type="chrome_scaled_image" name="IDR_THEME_FRAME" file="theme_frame.png" />
<structure type="chrome_scaled_image" name="IDR_THEME_FRAME_INACTIVE" file="theme_frame_inactive.png" />
<structure type="chrome_scaled_image" name="IDR_THEME_FRAME_INCOGNITO" file="theme_frame_incognito.png" />
<structure type="chrome_scaled_image" name="IDR_THEME_FRAME_INCOGNITO_INACTIVE" file="theme_frame_incognito_inactive.png" />
</if>
<if expr="use_ash">
<structure type="chrome_scaled_image" name="IDR_THEME_FRAME" file="notused.png" />
<structure type="chrome_scaled_image" name="IDR_THEME_FRAME_INACTIVE" file="notused.png" />
<structure type="chrome_scaled_image" name="IDR_THEME_FRAME_INCOGNITO" file="notused.png" />
<structure type="chrome_scaled_image" name="IDR_THEME_FRAME_INCOGNITO_INACTIVE" file="notused.png" />
</if>
<structure type="chrome_scaled_image" name="IDR_THEME_FRAME" file="notused.png" />
<structure type="chrome_scaled_image" name="IDR_THEME_FRAME_INACTIVE" file="notused.png" />
<structure type="chrome_scaled_image" name="IDR_THEME_FRAME_INCOGNITO" file="notused.png" />
<structure type="chrome_scaled_image" name="IDR_THEME_FRAME_INCOGNITO_INACTIVE" file="notused.png" />
<structure type="chrome_scaled_image" name="IDR_THEME_FRAME_OVERLAY" file="notused.png" />
<structure type="chrome_scaled_image" name="IDR_THEME_FRAME_OVERLAY_INACTIVE" file="notused.png" />
<structure type="chrome_scaled_image" name="IDR_THEME_NTP_ATTRIBUTION" file="notused.png" />
<structure type="chrome_scaled_image" name="IDR_THEME_NTP_BACKGROUND" file="common/ntp_background.png" />
<if expr="not use_ash and not is_macosx and not is_ios">
<structure type="chrome_scaled_image" name="IDR_THEME_TAB_BACKGROUND" file="theme_tab_background.png" />
<structure type="chrome_scaled_image" name="IDR_THEME_TAB_BACKGROUND_INCOGNITO" file="theme_tab_background_incognito.png" />
</if>
<if expr="use_ash">
<!-- Ash has gray tab backgrounds, Windows uses blue. -->
<structure type="chrome_scaled_image" name="IDR_THEME_TAB_BACKGROUND" file="common/ash/theme_default_inactive.png" />
<structure type="chrome_scaled_image" name="IDR_THEME_TAB_BACKGROUND_INCOGNITO" file="common/ash/theme_default_inactive.png" />
<structure type="chrome_scaled_image" name="IDR_THEME_NTP_BACKGROUND" file="notused.png" />
<if expr="not is_macosx and not is_ios">
<structure type="chrome_scaled_image" name="IDR_THEME_TAB_BACKGROUND" file="notused.png" />
<structure type="chrome_scaled_image" name="IDR_THEME_TAB_BACKGROUND_INCOGNITO" file="notused.png" />
</if>
<if expr="is_macosx or is_ios">
<structure type="chrome_scaled_image" name="IDR_THEME_TAB_BACKGROUND" file="mac/theme_default_inactive.png" />
......@@ -590,7 +577,7 @@
<structure type="chrome_scaled_image" name="IDR_THEME_TAB_BACKGROUND_INCOGNITO" file="mac/theme_default_inactive.png" />
</if>
</if>
<structure type="chrome_scaled_image" name="IDR_THEME_TAB_BACKGROUND_V" file="theme_tab_background_glass.png" />
<structure type="chrome_scaled_image" name="IDR_THEME_TAB_BACKGROUND_V" file="notused.png" />
<if expr="not is_macosx and not is_ios">
<!-- This identifier exists to give us something to associate with a custom image that a theme can provide.
In normal themes, it's unused. -->
......
......@@ -28,7 +28,6 @@
#include "content/public/browser/browser_thread.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "ui/base/resource/data_pack.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/codec/png_codec.h"
#include "ui/gfx/geometry/safe_integer_conversions.h"
......@@ -1239,54 +1238,31 @@ void BrowserThemePack::CropImages(ImageCache* images) const {
}
void BrowserThemePack::CreateFrameImages(ImageCache* images) const {
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
// Create all the output images in a separate cache and move them back into
// the input images because there can be name collisions.
ImageCache temp_output;
for (size_t i = 0; i < arraysize(kFrameTintMap); ++i) {
int prs_id = kFrameTintMap[i].key;
gfx::Image frame;
// If there's no frame image provided for the specified id, then load
// the default provided frame. If that's not provided, skip this whole
// thing and just use the default images.
int prs_base_id = 0;
if (!prs_base_id) {
if (prs_id == PRS_THEME_FRAME_INCOGNITO_INACTIVE) {
prs_base_id = images->count(PRS_THEME_FRAME_INCOGNITO) ?
PRS_THEME_FRAME_INCOGNITO : PRS_THEME_FRAME;
} else if (prs_id == PRS_THEME_FRAME_OVERLAY_INACTIVE) {
prs_base_id = PRS_THEME_FRAME_OVERLAY;
} else if (prs_id == PRS_THEME_FRAME_INACTIVE) {
prs_base_id = PRS_THEME_FRAME;
} else if (prs_id == PRS_THEME_FRAME_INCOGNITO &&
!images->count(PRS_THEME_FRAME_INCOGNITO)) {
prs_base_id = PRS_THEME_FRAME;
} else {
prs_base_id = prs_id;
}
if (!images->count(prs_id)) {
// Fall back from inactive incognito to active incognito.
if (prs_id == PRS_THEME_FRAME_INCOGNITO_INACTIVE)
prs_id = PRS_THEME_FRAME_INCOGNITO;
// From there, fall back to the normal frame.
if (!images->count(prs_id))
prs_id = PRS_THEME_FRAME;
// Fall back from inactive overlay to overlay, but stop there.
if (prs_id == PRS_THEME_FRAME_OVERLAY_INACTIVE)
prs_id = PRS_THEME_FRAME_OVERLAY;
}
// Note that if the original ID and all the fallbacks are absent, the caller
// will rely on the frame colors instead.
if (images->count(prs_id)) {
frame = (*images)[prs_id];
} else if (prs_base_id != prs_id && images->count(prs_base_id)) {
frame = (*images)[prs_base_id];
} else if (prs_base_id == PRS_THEME_FRAME_OVERLAY) {
if (images->count(PRS_THEME_FRAME)) {
// If there is no theme overlay, don't tint the default frame,
// because it will overwrite the custom frame image when we cache and
// reload from disk.
frame = gfx::Image();
}
} else {
// If the theme doesn't specify an image, then apply the tint to
// the default frame.
frame = rb.GetImageNamed(IDR_THEME_FRAME);
}
if (!frame.IsEmpty()) {
temp_output[prs_id] = CreateHSLShiftedImage(
frame, GetTintInternal(kFrameTintMap[i].value));
temp_output[kFrameTintMap[i].key] = CreateHSLShiftedImage(
(*images)[prs_id], GetTintInternal(kFrameTintMap[i].value));
}
}
MergeImageCaches(temp_output, images);
......
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