From 0d0ba1848d1a11242b3758657d8753d5528d6e83 Mon Sep 17 00:00:00 2001 From: "sashab@chromium.org" Date: Tue, 3 Jun 2014 12:40:43 +0000 Subject: [PATCH] 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 --- chrome/app/nibs/ExtensionInstallPrompt.xib | 2 +- .../app/nibs/ExtensionInstallPromptNoWarnings.xib | 2 +- .../nibs/ExtensionInstallPromptWebstoreData.xib | 2 +- .../browser/extensions/extension_install_prompt.cc | 31 ++++++++---------- .../extensions/extension_uninstall_dialog.cc | 38 +++++++++------------- .../extensions/extension_install_dialog_view.cc | 2 +- .../extensions/extension_uninstall_dialog_view.cc | 2 +- 7 files changed, 34 insertions(+), 45 deletions(-) diff --git a/chrome/app/nibs/ExtensionInstallPrompt.xib b/chrome/app/nibs/ExtensionInstallPrompt.xib index e457bc36a516..561fb0d5dcce 100644 --- a/chrome/app/nibs/ExtensionInstallPrompt.xib +++ b/chrome/app/nibs/ExtensionInstallPrompt.xib @@ -223,7 +223,7 @@ NeXT TIFF v4.0 pasteboard type - {{380, 64}, {69, 69}} + {{380, 64}, {64, 64}} diff --git a/chrome/app/nibs/ExtensionInstallPromptNoWarnings.xib b/chrome/app/nibs/ExtensionInstallPromptNoWarnings.xib index 702dc1a26e76..6617ea0a6eb0 100644 --- a/chrome/app/nibs/ExtensionInstallPromptNoWarnings.xib +++ b/chrome/app/nibs/ExtensionInstallPromptNoWarnings.xib @@ -171,7 +171,7 @@ ARcABAAAAAEAAAACARwAAwAAAAEAAQAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA NeXT TIFF v4.0 pasteboard type - {{380, 66}, {69, 69}} + {{380, 66}, {64, 64}} diff --git a/chrome/app/nibs/ExtensionInstallPromptWebstoreData.xib b/chrome/app/nibs/ExtensionInstallPromptWebstoreData.xib index f82e5681cc8f..39d4c28b6391 100644 --- a/chrome/app/nibs/ExtensionInstallPromptWebstoreData.xib +++ b/chrome/app/nibs/ExtensionInstallPromptWebstoreData.xib @@ -345,7 +345,7 @@ NeXT TIFF v4.0 pasteboard type - {{380, 129}, {69, 69}} + {{380, 129}, {64, 64}} diff --git a/chrome/browser/extensions/extension_install_prompt.cc b/chrome/browser/extensions/extension_install_prompt.cc index 809b01a6548f..f02d35a8e794 100644 --- a/chrome/browser/extensions/extension_install_prompt.cc +++ b/chrome/browser/extensions/extension_install_prompt.cc @@ -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(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 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())); } diff --git a/chrome/browser/extensions/extension_uninstall_dialog.cc b/chrome/browser/extensions/extension_uninstall_dialog.cc index 7a04a5d2f522..ede28c9ebf63 100644 --- a/chrome/browser/extensions/extension_uninstall_dialog.cc +++ b/chrome/browser/extensions/extension_uninstall_dialog.cc @@ -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(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 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) { diff --git a/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc b/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc index b3b9df0cfb6b..f0c9fc3836d3 100644 --- a/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc +++ b/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc @@ -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. diff --git a/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc b/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc index 2587a4d7c611..9c639103c6bb 100644 --- a/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc +++ b/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc @@ -31,7 +31,7 @@ namespace { const int kRightColumnWidth = 210; -const int kIconSize = 69; +const int kIconSize = 64; class ExtensionUninstallDialogDelegateView; -- 2.11.4.GIT