Skip to content

Commit

Permalink
Just use the image skia from resouce bundle for default app icon.
Browse files Browse the repository at this point in the history
Another issue similar to 605884.

BUG=614992
[email protected]

Review-Url: https://codereview.chromium.org/2012273002
Cr-Commit-Position: refs/heads/master@{#397040}
(cherry picked from commit b801ad2)

Review URL: https://codereview.chromium.org/2034293002 .

Cr-Commit-Position: refs/branch-heads/2743@{crosswalk-project#218}
Cr-Branched-From: 2b3ae3b-refs/heads/master@{#394939}
  • Loading branch information
mitoshima committed Jun 3, 2016
1 parent 53a26bb commit f94447b
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions chrome/browser/extensions/extension_uninstall_dialog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,9 @@ const char kExtensionRemovedError[] =

const char kReferrerId[] = "chrome-remove-extension-dialog";

// Returns bitmap for the default icon with size equal to the default icon's
// pixel size under maximal supported scale factor.
SkBitmap GetDefaultIconBitmapForMaxScaleFactor(bool is_app) {
const gfx::ImageSkia& image =
is_app ? util::GetDefaultAppIcon() : util::GetDefaultExtensionIcon();
return image.GetRepresentation(
gfx::ImageSkia::GetMaxSupportedScale()).sk_bitmap();
// Returns gfx::ImageSkia for the default icon.
gfx::ImageSkia GetDefaultIconImage(bool is_app) {
return is_app ? util::GetDefaultAppIcon() : util::GetDefaultExtensionIcon();
}

} // namespace
Expand Down Expand Up @@ -107,13 +103,7 @@ void ExtensionUninstallDialog::ConfirmUninstall(

void ExtensionUninstallDialog::SetIcon(const gfx::Image& image) {
if (image.IsEmpty()) {
// Let's set default icon bitmap whose size is equal to the default icon's
// pixel size under maximal supported scale factor. If the bitmap is larger
// than the one we need, it will be scaled down by the ui code.
// TODO(tbarzic): We should use IconImage here and load the required bitmap
// lazily.
icon_ = gfx::ImageSkia::CreateFrom1xBitmap(
GetDefaultIconBitmapForMaxScaleFactor(extension_->is_app()));
icon_ = GetDefaultIconImage(extension_->is_app());
} else {
icon_ = *image.ToImageSkia();
}
Expand Down

0 comments on commit f94447b

Please sign in to comment.