diff options
author | sashab@chromium.org <sashab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-03 12:40:43 +0000 |
---|---|---|
committer | sashab@chromium.org <sashab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-03 12:40:43 +0000 |
commit | 0d0ba1848d1a11242b3758657d8753d5528d6e83 (patch) | |
tree | f042afb0a54296f73faa6693d8db4841f4a6913f | |
parent | e89b1bdfcc7b5108c96739d9f970df1ac99fc7b3 (diff) | |
download | chromium_src-0d0ba1848d1a11242b3758657d8753d5528d6e83.zip chromium_src-0d0ba1848d1a11242b3758657d8753d5528d6e83.tar.gz chromium_src-0d0ba1848d1a11242b3758657d8753d5528d6e83.tar.bz2 |
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
7 files changed, 34 insertions, 45 deletions
diff --git a/chrome/app/nibs/ExtensionInstallPrompt.xib b/chrome/app/nibs/ExtensionInstallPrompt.xib index e457bc3..561fb0d 100644 --- a/chrome/app/nibs/ExtensionInstallPrompt.xib +++ b/chrome/app/nibs/ExtensionInstallPrompt.xib @@ -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"/> diff --git a/chrome/app/nibs/ExtensionInstallPromptNoWarnings.xib b/chrome/app/nibs/ExtensionInstallPromptNoWarnings.xib index 702dc1a..6617ea0 100644 --- a/chrome/app/nibs/ExtensionInstallPromptNoWarnings.xib +++ b/chrome/app/nibs/ExtensionInstallPromptNoWarnings.xib @@ -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"/> diff --git a/chrome/app/nibs/ExtensionInstallPromptWebstoreData.xib b/chrome/app/nibs/ExtensionInstallPromptWebstoreData.xib index f82e568..39d4c28 100644 --- a/chrome/app/nibs/ExtensionInstallPromptWebstoreData.xib +++ b/chrome/app/nibs/ExtensionInstallPromptWebstoreData.xib @@ -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"/> diff --git a/chrome/browser/extensions/extension_install_prompt.cc b/chrome/browser/extensions/extension_install_prompt.cc index 809b01a..f02d35a 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<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())); } diff --git a/chrome/browser/extensions/extension_uninstall_dialog.cc b/chrome/browser/extensions/extension_uninstall_dialog.cc index 7a04a5d..ede28c9 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<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) { 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 b3b9df0c..f0c9fc3 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 2587a4d..9c63910 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; |