Commit 0d0ba184 authored by sashab@chromium.org's avatar sashab@chromium.org

Resized the icon in the Uninstall dialog to be 64x64 px

Resized the icon in the Uninstall dialog to be 64x64 px instead of
69x69px, so that it matches the icon in the App Info dialog where
it can be launched. This also removes fuzzing effects on icons
that have to be resized from 64x64 icons.
Also fixed the duplication of this constant by letting the view
resize the icon it receives, rather than having it request one size of
icon and then resize it a second time.

[Mac] XIB change:
  - Resized the icon in the Install dialogs from 69x69 to 64x64

Screenshots on bug.

BUG=379613

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274487 0039d316-1c4b-4281-b951-d872f2087c98
parent e89b1bdf
......@@ -223,7 +223,7 @@
<string>NeXT TIFF v4.0 pasteboard type</string>
</object>
</object>
<string key="NSFrame">{{380, 64}, {69, 69}}</string>
<string key="NSFrame">{{380, 64}, {64, 64}}</string>
<reference key="NSSuperview" ref="359431345"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="212922230"/>
......
......@@ -171,7 +171,7 @@ ARcABAAAAAEAAAACARwAAwAAAAEAAQAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA</bytes>
<string>NeXT TIFF v4.0 pasteboard type</string>
</object>
</object>
<string key="NSFrame">{{380, 66}, {69, 69}}</string>
<string key="NSFrame">{{380, 66}, {64, 64}}</string>
<reference key="NSSuperview" ref="232836874"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="478302198"/>
......
......@@ -345,7 +345,7 @@
<string>NeXT TIFF v4.0 pasteboard type</string>
</object>
</object>
<string key="NSFrame">{{380, 129}, {69, 69}}</string>
<string key="NSFrame">{{380, 129}, {64, 64}}</string>
<reference key="NSSuperview" ref="606567991"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="721552738"/>
......
......@@ -119,15 +119,6 @@ static const int
IDS_EXTENSION_PROMPT_WILL_HAVE_ACCESS_TO,
};
// Size of extension icon in top left of dialog.
const int kIconSize = 69;
// Returns pixel size under maximal scale factor for the icon whose device
// independent size is |size_in_dip|
int GetSizeForMaxScaleFactor(int size_in_dip) {
return static_cast<int>(size_in_dip * gfx::ImageSkia::GetMaxSupportedScale());
}
// 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) {
......@@ -690,18 +681,24 @@ void ExtensionInstallPrompt::LoadImageIfNeeded() {
return;
}
// Load the image asynchronously. For the response, check OnImageLoaded.
extensions::ExtensionResource image = extensions::IconsInfo::GetIconResource(
extension_,
extension_misc::EXTENSION_ICON_LARGE,
ExtensionIconSet::MATCH_BIGGER);
// Load the icon whose pixel size is large enough to be displayed under
// maximal supported scale factor. UI code will scale the icon down if needed.
// TODO(tbarzic): We should use IconImage here and load the required bitmap
// lazily.
int pixel_size = GetSizeForMaxScaleFactor(kIconSize);
extensions::ImageLoader::Get(install_ui_->profile())->LoadImageAsync(
extension_, image, gfx::Size(pixel_size, pixel_size),
// Load the image asynchronously. The response will be sent to OnImageLoaded.
extensions::ImageLoader* loader =
extensions::ImageLoader::Get(install_ui_->profile());
std::vector<extensions::ImageLoader::ImageRepresentation> images_list;
images_list.push_back(extensions::ImageLoader::ImageRepresentation(
image,
extensions::ImageLoader::ImageRepresentation::NEVER_RESIZE,
gfx::Size(),
ui::SCALE_FACTOR_100P));
loader->LoadImagesAsync(
extension_,
images_list,
base::Bind(&ExtensionInstallPrompt::OnImageLoaded, AsWeakPtr()));
}
......
......@@ -30,14 +30,6 @@
namespace {
// Returns pixel size under maximal scale factor for the icon whose device
// independent size is |size_in_dip|
int GetSizeForMaxScaleFactor(int size_in_dip) {
float max_scale_factor_scale = gfx::ImageSkia::GetMaxSupportedScale();
return static_cast<int>(size_in_dip * max_scale_factor_scale);
}
// 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) {
......@@ -50,9 +42,6 @@ SkBitmap GetDefaultIconBitmapForMaxScaleFactor(bool is_app) {
} // namespace
// Size of extension icon in top left of dialog.
static const int kIconSize = 69;
ExtensionUninstallDialog::ExtensionUninstallDialog(
Profile* profile,
Browser* browser,
......@@ -85,28 +74,31 @@ void ExtensionUninstallDialog::ConfirmUninstall(
const extensions::Extension* extension) {
DCHECK(ui_loop_ == base::MessageLoop::current());
extension_ = extension;
// Bookmark apps may not have 128x128 icons so accept 48x48 icons.
// Bookmark apps may not have 128x128 icons so accept 64x64 icons.
const int icon_size = extension_->from_bookmark()
? extension_misc::EXTENSION_ICON_MEDIUM
: extension_misc::EXTENSION_ICON_LARGE;
? extension_misc::EXTENSION_ICON_SMALL * 2
: extension_misc::EXTENSION_ICON_LARGE;
extensions::ExtensionResource image = extensions::IconsInfo::GetIconResource(
extension_,
icon_size,
ExtensionIconSet::MATCH_BIGGER);
// Load the icon whose pixel size is large enough to be displayed under
// maximal supported scale factor. UI code will scale the icon down if needed.
int pixel_size = GetSizeForMaxScaleFactor(kIconSize);
// Load the image asynchronously. The response will be sent to OnImageLoaded.
state_ = kImageIsLoading;
extensions::ImageLoader* loader =
extensions::ImageLoader::Get(profile_);
loader->LoadImageAsync(extension_,
image,
gfx::Size(pixel_size, pixel_size),
base::Bind(&ExtensionUninstallDialog::OnImageLoaded,
AsWeakPtr(),
extension_->id()));
std::vector<extensions::ImageLoader::ImageRepresentation> images_list;
images_list.push_back(extensions::ImageLoader::ImageRepresentation(
image,
extensions::ImageLoader::ImageRepresentation::NEVER_RESIZE,
gfx::Size(),
ui::SCALE_FACTOR_100P));
loader->LoadImagesAsync(extension_,
images_list,
base::Bind(&ExtensionUninstallDialog::OnImageLoaded,
AsWeakPtr(),
extension_->id()));
}
void ExtensionUninstallDialog::SetIcon(const gfx::Image& image) {
......
......@@ -58,7 +58,7 @@ using extensions::BundleInstaller;
namespace {
// Size of extension icon in top left of dialog.
const int kIconSize = 69;
const int kIconSize = 64;
// We offset the icon a little bit from the right edge of the dialog, to make it
// align with the button below it.
......
......@@ -31,7 +31,7 @@
namespace {
const int kRightColumnWidth = 210;
const int kIconSize = 69;
const int kIconSize = 64;
class ExtensionUninstallDialogDelegateView;
......
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